code: def main(upload, upload_only, allow_partial_uploads, user):
      if upload_only:
          # if you are only uploading you shouldn't need to specify both flags
          upload = True
      procs = (
          (
              py_version,
              npy_version,
              (
                  subprocess.Popen(**mkargs(py_version, npy_version))
                  if not upload_only
                  else None
              ),
          )
          for py_version, npy_version in product(
              py_versions, npy_versions
          )
      )
      status = 0
      files = []
      for py_version, npy_version, proc in procs:
          if not upload_only:
              out, err = proc.communicate()
              if proc.returncode:
                  status = 1
                  print(
                      "build failure: python=%s numpy=%s\n%s"
                      % (
                          py_version,
                          npy_version,
                          err.decode("utf-8"),
                      )
                  )
                  # don't add the filename to the upload list if the build
                  # fails
                  continue
  
          if upload:
              p = subprocess.Popen(
                  **mkargs(py_version, npy_version, output=True)
              )
              out, err = p.communicate()
              if p.returncode:
                  status = 1
                  print(
                      "failed to get the output name for python=%s numpy=%s\n"
                      "%s"
                      % (py_version, npy_version, err.decode("utf-8")),
                  )
              else:
                  files.append(out.decode("utf-8").strip())
  
      if (not status or allow_partial_uploads) and upload:
          for f in files:
              p = subprocess.Popen(
                  ["anaconda", "upload", "-u", user, f],
                  stdout=subprocess.DEVNULL,
                  stderr=subprocess.DEVNULL,
              )
              out, err = p.communicate()
              if p.returncode:
                  # only change the status to failure if we are not allowing
                  # partial uploads
                  status |= not allow_partial_uploads
                  print(
                      "failed to upload: %s\n%s"
                      % (f, err.decode("utf-8"))
                  )
      return status
  
imports: from itertools import product
  import os
  import subprocess
  import click
label_desc: Use image node_id 2 for calling a global function with example usage: main(upload, upload_only, allow_partial_uploads, user) and returns: status