Unlocking an Iphone 3g

I bought an Iphone 3g from a friend, the service provider is T mobile, I have Metro PCS. How can I unlock the phone so that I can use it with Metro? Is it something that can be done at my house or do I need to take it somewhere and have them do it?
Well, if I recall correctly, the iPhone 3G was only released on AT&T, so it must be unlocked if it's on T-Mobile.

And, from MetroPCS' website:
Details: MetroPCS does not sell the iPhone and is not affiliated with Apple Inc. Only T-Mobile’s and AT&T’s iPhones, and Verizon’s and Sprint’s iPhone 5 will work on our network. iPhones may have limited functionality, including coverage limitations.
Bring Your Own Phone | Nationwide 4G Coverage | No Contract | MetroPCS

EDIT:
Operate your Unlocked iPhone with the Help of Metro PCS Services
Untitled

Well, it looks like you can use the 3G on Metro, you'll need a regular SIM card. Be aware though, you might operate at 2G, and at most, 3G speeds.

Original thread: https://forums.imore.com/threads/unlocking-an-iphone-3g.280246/