How to unlock iPhone 5s?

OK so I bought a second hand iPhone and turned it on but I need to set it up right? Well it needs a simcard to set up and I don't know what network it's locked to as I tried EE and it was invalid.. So is there a way I can unlock it free using the imei? Thanks for any feedback!
Contact the person you bought it from and ask what network was used by him. He should know that answer.

After that you can contact the helpdesk of that network and ask for further instructions.

Yes, there are websites and shops offering unlocking but I don't trust anybody else on my iDevices except Apple.

Original thread: https://forums.imore.com/threads/how-to-unlock-iphone-5s.368707/