How do I make every vertex to be associated with the same number of bones?
There is an operator called Limit Number of Weights per Vertex:


  Limit deform weights associated with a vertex to a specified number by removing lowest weights


Operator call in Python:

bpy.ops.object.vertex_group_limit_total(group_select_mode='ALL', limit=4)


You can find it while in Edit Mode of the parented mesh,
in the 3D View T-toolshelf > Tools > Weight Tools > Limit Total.

Or you go to Weight Paint mode > Weights menu > Limit Total.