def _googleauth(key_file=None, scopes=[], user_agent=None):
if key_file:<EOL><INDENT>if not scopes:<EOL><INDENT>scopes = DEFAULT_SCOPES<EOL><DEDENT>creds = ServiceAccountCredentials.from_json_keyfile_name(key_file,<EOL>scopes=scopes)<EOL><DEDENT>else:<EOL><INDENT>creds = GoogleCredentials.get_application_default()<EOL><DEDENT>http = Http()<EOL>if user_agent:<EOL><INDENT>http = set_user_agent(http, user_agent)<EOL><DEDENT>http_auth = creds.authorize(http)<EOL>return http_auth<EOL>
Google http_auth helper.

If key_file is not specified, default credentials will be used.

If scopes is specified (and key_file), will be used instead of DEFAULT_SCOPES

:param key_file: path to key file to use. Default is None
:type key_file: ``str``

:param scopes: scopes to set.  Default is DEFAUL_SCOPES
:type scopes: ``list``

:param user_agent: User Agent string to use in requests. Default is None.
:type http_auth: ``str`` or None

:return: HTTPLib2 authorized client.
:rtype: :class: `HTTPLib2`