def _call_helper()

in yum/artifact-registry.py [0:0]


def _call_helper(service_account_json=None, service_account_email=None,
                 debug=False):
  args = []
  # JSON has priority over email.
  if service_account_json:
    args.append('--service_account_json=' + service_account_json)
  elif service_account_email:
    args.append('--service_account_email=' + service_account_email)

  if debug:
    # Inherit stderr to see debug statements
    stderr = None
  else:
    stderr = PIPE

  try:
    cmd = Popen([token_cmd] + args, stdout=PIPE, stderr=stderr)
  except OSError as e:
    print('Error trying to obtain Google credentials: %s' % e)
    return

  retcode = cmd.wait()
  if retcode != 0:
    print('Error trying to obtain Google credentials: command returned %d'
          % retcode)
    return

  return cmd.stdout.read()