Refactored common code in salt.module.pip to make it easier to main...

...tain and simplify the code