docs: def persist(self, container: Container, image_name: str) -> None:
          """
          Persists the state of a given container as a Docker image on the
          server.
  
          Parameters:
              container: the container that should be persisted.
              image_name: the name of the Docker image that should be created.
  
          Raises:
              ContainerNotFound: if the given container does not exist on the
                  server.
              ImageAlreadyExists: if the given image name is already in use by
                  another Docker image on the server.
          """
          logger.debug("attempting to persist container (%s) to image (%s).",
                       container.id,
                       image_name)
          path = "containers/{}/persist/{}".format(container.id, image_name)
          r = self.__api.put(path)
          if r.status_code == 204:
              logger.debug("persisted container (%s) to image (%s).",
                           container.id,
                           image_name)
              return
          try:
              self.__api.handle_erroneous_response(r)
          except Exception:
              logger.exception("failed to persist container (%s) to image (%s).",  # noqa: pycodestyle
                               container.id,
                               image_name)
              raise