def get_google_auth(state=None, token=None): if token: return OAuth2Session(OAuth.get_client_id(), token=token) if state: return OAuth2Session(OAuth.get_client_id(), state=state, scope=OAuth.SCOPE, redirect_uri=OAuth.get_redirect_uri()) oauth = OAuth2Session(OAuth.get_client_id(), scope=OAuth.SCOPE, redirect_uri=OAuth.get_redirect_uri()) return oauth