def version_tuple(v):
    """Creates a version tuple from a version string for consistent comparison of versions.

    Conversion to tuples is needed because version '2.12.9' is higher then '2.7.8' however::

    >>> '2.12.9' > '2.7.8'
    False

    Instead we need:

    >>> version_tuple('2.12.9') > version_tuple('2.7.8')
    True
    """
    return tuple(map(int, (v.split("."))))