'Push an image identified by a local tag to the given registry.
:param unicode image_name: The local tag which identifies the image to
push.
:param Registry registry: The registry to which to push the image.
:return: A ``DockerImage`` describing the image in the registry.  Note
in particular the tag of the image in the registry will differ from
the local tag of the image.'

def push_to_registry(self, image_name, registry):

    registry_name = random_name(self).lower()
    registry_image = DockerImage(repository=((registry.repository + '/') + registry_name), tag='latest')
    client = dockerpy_client()
    client.tag(image=image_name, repository=registry_image.repository, tag=registry_image.tag)
    try:
        client.push(repository=registry_image.repository, tag=registry_image.tag)
    finally:
        client.remove_image(image=registry_image.full_name)
    return registry_image
