O2 claim you can unlock their phones in one of the following two ways
a) if they were bought from carphone warehouse put an O2 sim in them and “sync it with itunes via your pc”
b) if they were bought from an unknown source buy an O2 payg sim topup with £15 make 1 phone call top up the amount of the call you just made then wait 24 hours then call O2 for unlock code and they will deduct £15 from your balance
but no they are wrong when i try to use a lycamobile sim i now get
The SIM card that you currently have installed in this iPhone is from a carrier that is not supported under the activation policy that is currently assigned by the activation server. This is not a hardware issue with the iPhone. Please insert another SIM card from a supported carrier or request that this iPhone be unlocked by your carrier. Please contact Apple for more information.