docs: def persist(self, container: Container, image: str) -> None:
          """
          Persists the state of a given container to a BugZoo image on this
          server.
  
          Parameters:
              container: the container to persist.
              image: the name of the Docker image that should be created.
  
          Raises:
              ImageAlreadyExists: if the image name is already in use by another
                  Docker image on this server.
          """
          logger_c = logger.getChild(container.uid)
          logger_c.debug("Persisting container as a Docker image: %s", image)
          try:
              docker_container = self.__dockerc[container.uid]
          except KeyError:
              logger_c.exception("Failed to persist container: container no longer exists.")  # noqa: pycodestyle
              raise
          try:
              _ = self.__client_docker.images.get(image)
              logger_c.error("Failed to persist container: image, '%s', already exists.",  # noqa: pycodestyle
                           image)
              raise ImageAlreadyExists(image)
          except docker.errors.ImageNotFound:
              pass
  
          cmd = "docker commit {} {}"
          cmd = cmd.format(docker_container.id, image)
          try:
              subprocess.check_output(cmd, shell=True)
          except subprocess.CalledProcessError:
              logger.exception("Failed to persist container (%s) to image (%s).",  # noqa: pycodestyle
                               container.uid, image)
              raise
          logger_c.debug("Persisted container as a Docker image: %s", image)