def versions_for(v):
    if isinstance(v, spack.version.Version):
        return [v]
    elif isinstance(v, spack.version.VersionRange):
        result = ([v.start] if v.start else [])
        result += ([v.end] if v.end else [])
        return result
    elif isinstance(v, spack.version.VersionList):
        return sum((versions_for(e) for e in v), [])
    else:
        raise TypeError(('expected version type, found: %s' % type(v)))
def versions_for(v):
    if isinstance(v, spack.version.Version):
        return [v]
    elif isinstance(v, spack.version.VersionRange):
        result = ([v.start] if v.start else [])
        result += ([v.end] if v.end else [])
        return result
    elif isinstance(v, spack.version.VersionList):
        return sum((versions_for(e) for e in v), [])
    else:
        raise TypeError(('expected version type, found: %s' % type(v)))