Refactor partnership and implement full partnership functions

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