also, in this case, why not just combine this with the previous if:

    credentials_type = client_credentials.get('type')
    if credentials_type == 'authorized_user':
      ...
    elif credentials_type == 'service_account':
      ...
    else:
      raise DefaultCredentialsError(...)