Refactor partnership and implement full partnership functions

@houndci @cgruppioni @georgetmayorga
Line is too long. [92/80]