def _get_token(<EOL>request=None, allowed_auth_schemes=('<STR_LIT>', '<STR_LIT>'),<EOL>allowed_query_keys=('<STR_LIT>', '<STR_LIT>')):
allowed_auth_schemes = _listlike_guard(<EOL>allowed_auth_schemes, '<STR_LIT>', iterable_only=True)<EOL>auth_header = os.environ.get('<STR_LIT>')<EOL>if auth_header:<EOL><INDENT>for auth_scheme in allowed_auth_schemes:<EOL><INDENT>if auth_header.startswith(auth_scheme):<EOL><INDENT>return auth_header[len(auth_scheme) + <NUM_LIT:1>:]<EOL><DEDENT><DEDENT>return None<EOL><DEDENT>if request:<EOL><INDENT>allowed_query_keys = _listlike_guard(<EOL>allowed_query_keys, '<STR_LIT>', iterable_only=True)<EOL>for key in allowed_query_keys:<EOL><INDENT>token, _ = request.get_unrecognized_field_info(key)<EOL>if token:<EOL><INDENT>return token<EOL><DEDENT><DEDENT><DEDENT>
Get the auth token for this request.

    Auth token may be specified in either the Authorization header or
    as a query param (either access_token or bearer_token).  We'll check in
    this order:
      1. Authorization header.
      2. bearer_token query param.
      3. access_token query param.

    Args:
      request: The current request, or None.

    Returns:
      The token in the request or None.