code: def get_credentials(scopes=None, secrets=None, storage=None, no_webserver=False):
      
      scopes = Scopes.get(scopes)
  
      if secrets is None:
          secrets = SECRETS
      if storage is None:
          storage = STORAGE
  
      secrets, storage = map(os.path.expanduser, (secrets, storage))
  
      store = file.Storage(storage)
      creds = store.get()
  
      if creds is None or creds.invalid:
          flow = client.flow_from_clientsecrets(secrets, scopes)
          args = ['--noauth_local_webserver'] if no_webserver else []
          flags = tools.argparser.parse_args(args)
          creds = tools.run_flow(flow, store, flags)
  
      return creds
docs: Make OAuth 2.0 credentials for scopes from ``secrets`` and ``storage`` files.
  
      Args:
          scopes: scope URL(s) or ``'read'``, ``'write'`` (default: ``%r``)
          secrets: location of secrets file (default: ``%r``)
          storage: location of storage file (default: ``%r``)
          no_webserver: url/code prompt instead of webbrowser based auth
  
      see https://developers.google.com/sheets/quickstart/python
      see https://developers.google.com/api-client-library/python/guide/aaa_client_secrets