code: def get_credentials(*, scopes):
      
      credential_dir = os.path.join(HOME_DIR, ".cache", __package__, "credentials")
      if not os.path.exists(credential_dir):
          os.makedirs(credential_dir)
      credential_path = os.path.join(credential_dir, "googleapis.json")
  
      store = Storage(credential_path)
      credentials = store.get()
  
      # see https://developers.google.com/api-client-library/python/auth/web-app
      # kw: "incremental scopes"
      if not credentials or credentials.invalid or not credentials.has_scopes(scopes):
          flow = client.flow_from_clientsecrets(GOOGLE_SECRETS, scopes)
          flow.user_agent = "Bonobo ETL (https://www.bonobo-project.org/)"
          flags = argparser.parse_args(["--noauth_local_webserver"])
          credentials = tools.run_flow(flow, store, flags)
          print("Storing credentials to " + credential_path)
      return credentials
docs: Gets valid user credentials from storage.
  
      If nothing has been stored, or if the stored credentials are invalid,
      the OAuth2 flow is completed to obtain the new credentials.
  
      Returns:
          Credentials, the obtained credential.