Refactoring _get_environment.

- Removes use of "global" by putting the env name in another
  namespace.
- Splits logic into digestible pieces.
- Also makes slight change to GoogleCredentials docstring.