@classmethod
def parse(cls, image_name):
    """
        Get the instance of ImageName from the string representation.

        :param image_name: str (any possible form of image name)
        :return: ImageName instance
        """
    result = cls()
    s = image_name.split('/', 2)
    if len(s) == 2:
        if '.' in s[0] or ':' in s[0]:
            result.registry = s[0]
        else:
            result.namespace = s[0]
    elif len(s) == 3:
        result.registry = s[0]
        result.namespace = s[1]
    result.repository = s[-1]
    try:
        result.repository, result.digest = result.repository.rsplit('@', 1)
    except ValueError:
        try:
            result.repository, result.tag = result.repository.rsplit(':', 1)
        except ValueError:
            result.tag = 'latest'
    return result
