code: def ensure_local_image(
          local_image: str,
          parent_image: str = SC_PARENT_IMAGE,
          java_image: str = SC_JAVA_IMAGE,
          starcraft_base_dir: str = SCBW_BASE_DIR,
          starcraft_binary_link: str = SC_BINARY_LINK,
  ) -> None:
      
      logger.info(f"checking if there is local image {local_image}")
      docker_images = docker_client.images.list(local_image)
      if len(docker_images) and docker_images[0].short_id is not None:
          logger.info(f"image {local_image} found locally.")
          return
  
      logger.info("image not found locally, creating...")
      pkg_docker_dir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "local_docker")
      base_dir = os.path.join(starcraft_base_dir, "docker")
      logger.info(f"copying files from {pkg_docker_dir} to {base_dir}.")
      distutils.dir_util.copy_tree(pkg_docker_dir, base_dir)
  
      starcraft_zip_file = f"{base_dir}/starcraft.zip"
      if not os.path.exists(starcraft_zip_file):
          logger.info(f"downloading starcraft.zip to {starcraft_zip_file}")
          download_file(starcraft_binary_link, starcraft_zip_file)
  
      logger.info(f"pulling image {parent_image}, this may take a while...")
      pulled_image = docker_client.images.pull(parent_image)
      pulled_image.tag(java_image)
  
      logger.info(f"building local image {local_image}, this may take a while...")
      docker_client.images.build(path=base_dir, dockerfile="game.dockerfile", tag=local_image)
      logger.info(f"successfully built image {local_image}")
docs: Check if `local_image` is present locally. If it is not, pull parent images and build.
      This includes pulling starcraft binary.
  
      :raises docker.errors.ImageNotFound
      :raises docker.errors.APIError