How can I uniformly modify a pipe with coding? I have a plain pipe with a center-line. I need to gradually decrease its diameter towards the end (to create a taper). I've been told that I should use some codes to scale the bones automatically. I would be grateful if anyone could kindly help me with this question.  

This is actually a practice. The main task is to modify a 3D model of a vessel (which is more complex) using blender. 

Thank you very much. 

Mohammadreza
It may be that you need nothing more than a proportional edit, set to 'Linear' profile, and in 'Connected' mode. 

With Median Point as your pivot, select an edge loop at one end of your pipe. The extent of the scaling along normals (AltS) will depend not on the geometric distance from your selection, but on the topological distance (the total edge-length from your selection).. so it works round corners, linearly tapering as you go. 

The circle in the 3D view may no longer be a visual indicator of extent - just keep growing it until you begin to see the influence at the other end of your pipe.