If you bought an iPhone that it's locked on the cloud, then the easiest way to unlock it is by contacting the seller. In case it's not possible either contact Apple Support or visit a local phone service shop and ask them if it's possible to remove the restriction.
You should know that in both cases, the price for unlocking the device could actually be more than half of a brand new version of the iPhone which translates into "a lot".