Blender python question

I want to call upon a function whenever i select a new pose bone.

How should i do that?