Traffic Shaping Processes in Linux

How to control the behaviour of network traffic from a process, using throttling and rate limiting with tc and cgroups in linux