'Given a Docker image name, return a :class:`DockerImage`.
:param unicode input_name: A Docker image name in the format
``repository[:tag]``.
:raises ValueError: If Docker image name is not in a valid format.
:returns: A ``DockerImage`` instance.'

@classmethod
def from_string(cls, input_name):

    kwargs = {}
    parts = input_name.rsplit(u':', 1)
    repository = parts[0]
    if (not repository):
        raise ValueError("Docker    image    names    must    have    format    'repository[:tag]'.    Found    '{image_name}'.".format(image_name=input_name))
    kwargs['repository'] = repository
    if (len(parts) == 2):
        kwargs['tag'] = parts[1]
    return cls(**kwargs)
