code: def publish(digest, pid, api_key, tag):
      """
      Publishes given image identified by given image digest. Prints the result of this operation.
      Latest tag is automatically applied.
      :param digest: A digest of the docker image to check errors of
      :param pid: Project identified (PID) from Red Hat Connect portal
      :param api_key: API Key associated with the Red Hat account. Considered secret.
      :param tag: An existing container tag for container identification
      :return: Nothing.
      """
      url = "https://connect.redhat.com/api/v2/projects/{}/containers/{}/tags/{}/publish".format(
          pid, digest, tag
      )
      headers = {
          "accept": "*/*",
          "Content-Type": "application/json",
          "Authorization": "Bearer {}".format(api_key),
      }
  
      response = requests.post(url, headers=headers)
  
      if response.status_code != 201:
          print(
              "Unable to publish, invalid status code: {}.".format(
                  response.status_code
              )
          )
          print(response)
          print(response.content)
          sys.exit(1)
      else:
          print(
              "Docker image '{}' successfully scheduled for publishing.".format(
                  digest
              )
          )
  
imports: import argparse
  import sys
  import time
  import requests
label_desc: Use image node_id 2 for calling a global function with example usage: publish(digest, pid, api_key, tag) without return types