Contacted T-Mobile to help a friend unlock IPhone 5 that was originally purchased from T-Mobile. After a lot of discussion with them, they sent a procedure which does not include a unlock code. I thought we needed one. They said to wait 24 hours before trying the procedure. I hope the procedure works and does not require T-Mobile cell service to work. The basic procedure is to back up the phone via ITunes erase the phone and restore. I assume behind the scenes T-Mobile contacts Apple and says to unlock the phone.