Separate pip freeze command from operation

By extracting the logic into pip.operations.freeze, the hope is that
folks could do a freeze programmatically more easily.
Merge pull request #2173 from msabramo/extract_freeze_operation

Separate pip freeze command from operation