def push_to_registry(self, image, image_tag: str):
<EOL>if f"<STR_LIT>" in image.tags:<EOL><INDENT>return<EOL><DEDENT>image.tag(self.use_registry_name, image_tag)<EOL>result = self.client.images.push(self.use_registry_name, image_tag)<EOL>result = result.strip()  <EOL>last_line = json.loads(result.split("<STR_LIT:\n>")[-<NUM_LIT:1>])<EOL>if "<STR_LIT:error>" in last_line:<EOL><INDENT>self.client.images.remove(f"<STR_LIT>")<EOL>raise PushToRegistryError(f"<STR_LIT>", full_output=result)<EOL><DEDENT>logger.info("<STR_LIT>", self.use_registry_name, image_tag)<EOL>logger.debug("<STR_LIT>", result)<EOL>
Pushes a local image to a registry based on the ``use_registry_name`` setting.

        :type image: docker.models.images.Image
        :raise PushToRegistryError: If the push fails.