Nearest Neighbor

Is there any pre defined method(function) to calculate distance and angle(s) between the site and its nearest neighboring atoms?
Secondly, how can I calculate valence electronic configuration of an element?

Thanks in advance.

Check out the local_env module of Pymatgen for determining nearest neighbors:

For your second question there is another module: