Added keys and values methods for PairFunctions in python
fixed doc tests
Josh's and Patricks review comments.