Network unlock code not working
I have followed this guide and my phone is now unlocked.

I wouldn't recommend it for a beginner user, because it involves pretty advanced commands and procedures, and uses ROMs and tools from untrusted sources. Proceed at your own risk! 

The performed steps were basically:


Create a complete nandroid backup on the SD card.
Google for a stock ROM for the specific phone model I owned, and the specific carrier that it is locked to. I found one on a random forum. This is not recommended for obvious security reasons, but I was desperate. If your carrier provides an official stock ROM, I definitely recommend you prefer using it.
Googled for the ADB drivers for my phone model. In this case, the Motorola drivers worked fine.
Connected the phone to my computer and flashed the stock ROM. In my case, this actually downgraded my phone from android 4.0.4 to 2.3.3 and unrooted it.
Performed the unlock procedure using the unlock code I had.
Rooted my phone again, and installed a new recovery menu
Applied the nandroid backup from the recovery menu.


Result:

Phone is back as it was before, but unlocked.