Refactor partnership and implement full partnership functions

@houndci @cgruppioni @georgetmayorga
Use 2 (not 1) spaces for indentation.