code: def _get_credentials(self):
          
          client_secret_path = os.path.dirname(self.client_secret)
          auth_token_path = os.path.dirname(self.auth_token)
  
          if not os.path.exists(auth_token_path):
              os.makedirs(auth_token_path)
  
          if not os.path.exists(client_secret_path):
              os.makedirs(client_secret_path)
  
          flags = tools.argparser.parse_args(args=[])
          store = Storage(self.auth_token)
          credentials = store.get()
  
          if not credentials or credentials.invalid:
              try:
                  flow = client.flow_from_clientsecrets(self.client_secret, SCOPES)
                  flow.user_agent = APPLICATION_NAME
                  if flags:
                      credentials = tools.run_flow(flow, store, flags)
                  else:  # Needed only for compatibility with Python 2.6
                      credentials = tools.run(flow, store)
              except clientsecrets.InvalidClientSecretsError:
                  raise Exception("missing client_secret")
              """
              Have to restart i3 after getting credentials to prevent bad output.
              This only has to be done once on the first run of the module.
              """
              self.py3.command_run("{} restart".format(self.py3.get_wm_msg()))
  
          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.