Replace deprecated commands module. [Python 3 support]

Replacing the deprecated commands module (http://docs.python.org/2/library/commands.html) by a function doing the same thing using the recommended subprocess module.