Buy partner out

If you partner with someone on a deal and a few years later you want to buy them out so you have full control of the property, how would you structure that with them? Would you have to write up a contract and have an attorney sign it?