code: def get_parent_image_koji_data(workflow):
      
      koji_parent = workflow.prebuild_results.get(PLUGIN_KOJI_PARENT_KEY) or {}
      image_metadata = {}
  
      parents = {}
      for img, build in (koji_parent.get(PARENT_IMAGES_KOJI_BUILDS) or {}).items():
          if not build:
              parents[str(img)] = None
          else:
              parents[str(img)] = {key: val for key, val in build.items() if key in ('id', 'nvr')}
      image_metadata[PARENT_IMAGE_BUILDS_KEY] = parents
  
      # ordered list of parent images
      image_metadata[PARENT_IMAGES_KEY] = workflow.builder.parents_ordered
  
      # don't add parent image id key for scratch
      if workflow.builder.base_from_scratch:
          return image_metadata
  
      base_info = koji_parent.get(BASE_IMAGE_KOJI_BUILD) or {}
      parent_id = base_info.get('id')
      if parent_id is not None:
          try:
              parent_id = int(parent_id)
          except ValueError:
              logger.exception("invalid koji parent id %r", parent_id)
          else:
              image_metadata[BASE_IMAGE_BUILD_ID_KEY] = parent_id
      return image_metadata
docs: Transform koji_parent plugin results into metadata dict.