How to determine the angles between bones using a Python Script?

I want to calculate the angle between 3 points, the two ends of the selected bone and the centre of the thigh bone using a python script.

I have tried multiple methods but I am not able to figure out how to find the coordinate of the 3 points mentioned and then the angle between them using python script. Please help.

This is an exact copy of your question on Stackexchange. Did you read the answer I have you there?