code: def google_auth_flow(secret_file, scopes, code=None):
      # initialise flow
      flow = Flow.from_client_secrets_file(secret_file, scopes)
  
      # get host url from flask
      from flask import request
  
      flow.redirect_uri = request.headers["ORIGIN"] + "/verify-auth"
  
      if code:
          flow.fetch_token(code=code)
          creds = flow.credentials
          return creds
      else:
          auth_url = flow.authorization_url()[0]
          raise AuthException(
              f"Authorisation required. Please follow the url: {auth_url}",
              auth_url=auth_url,
          )
  
file_path: mindsdb/mindsdb/integrations/handlers/gmail_handler/utils.py
imports: import datetime
  import json
  from google_auth_oauthlib.flow import Flow
label_desc: Use image node_id 2 for calling a global function with example usage: google_auth_flow(secret_file, scopes, code) and returns: creds