Update python partnership library

@lopatin I made a bunch of changes in several commits, please review.  Thanks!