<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tag_and_push_image(self, image, target_image, insecure=False, force=False, dockercfg=None):
 """ tag provided image and push it to registry :param image: str or ImageName, image id or name :param target_image: ImageName, img :param insecure: bool, allow connecting to registry over plain http :param force: bool, force the tag? :param dockercfg: path to docker config :return: str, image (reg.com/img:v1) """

        logger.info("tagging and pushing image '%s' as '%s'", image, target_image)
        logger.debug("image = '%s', target_image = '%s'", image, target_image)
        self.tag_image(image, target_image, force=force)
        if dockercfg:
            self.login(registry=target_image.registry, docker_secret_path=dockercfg)
        return self.push_image(target_image, insecure=insecure)