code: def GitHub_authenticate(urls, username, token=None):
      _login_message = """\
  Enter your GitHub username & password or press ^C to quit. The password
  will be kept as a Python variable as long as this script is running and
  https to authenticate with GitHub, otherwise not saved anywhere else:\
  """
      if username:
          print("> Authenticating as %s" % username)
      else:
          print(_login_message)
          username = input("Username: ")
  
      authenticated = False
  
      if token:
          print("> Authenticating using token")
          try:
              GitHub_check_authentication(urls, username, None, token)
          except AuthenticationFailed:
              print(">     Authentication failed")
          else:
              print(">     OK")
              password = None
              authenticated = True
  
      while not authenticated:
          password = getpass("Password: ")
          try:
              print("> Checking username and password ...")
              GitHub_check_authentication(
                  urls, username, password, None
              )
          except AuthenticationFailed:
              print(">     Authentication failed")
          else:
              print(">     OK.")
              authenticated = True
  
      if password:
          generate = input("> Generate API token? [Y/n] ")
          if generate.lower() in ["y", "ye", "yes", ""]:
              name = input(
                  "> Name of token on GitHub? [SymPy Release] "
              )
              if name == "":
                  name = "SymPy Release"
              token = generate_token(
                  urls, username, password, name=name
              )
              print("Your token is", token)
              print(
                  "Use this token from now on as GitHub_release:token="
                  + token
                  + ",username="
                  + username
              )
              print(red("DO NOT share this token with anyone"))
              save = input(
                  "Do you want to save this token to a file [yes]? "
              )
              if save.lower().strip() in ["y", "yes", "ye", ""]:
                  save_token_file(token)
  
      return username, password, token
  
imports: import os
  import json
  from subprocess import check_output
  from collections import OrderedDict, defaultdict
  from collections.abc import Mapping
  import glob
  from contextlib import contextmanager
  import requests
  from requests_oauthlib import OAuth2
label_desc: Use image node_id 10 for calling a global function with example usage: GitHub_authenticate(urls, username, token) and returns: username,  password,  token