Split ``version`` into a lexicographically comparable tuple.

    "1.0.3" -> ((1, 0, 3),)
    "1.0.3-dev" -> ((1, 0, 3), ("dev",))
    "1.0.3-rc-5" -> ((1, 0, 3), ("rc",), (5,))

def tupleize_version(version):
    """
    Split ``version`` into a lexicographically comparable tuple.

    "1.0.3" -> ((1, 0, 3),)
    "1.0.3-dev" -> ((1, 0, 3), ("dev",))
    "1.0.3-rc-5" -> ((1, 0, 3), ("rc",), (5,))
    """

    if version is None:
        return (("unknown",),)

    if version.startswith("<unknown"):
        return (("unknown",),)

    split = re.split("(?:\.|(-))", version)
    parsed = tuple(try_fix_num(x) for x in split if x)

    # Put the tuples in groups by "-"
    def is_dash(s):
        return s == "-"
    grouped = groupby(parsed, is_dash)

    return tuple(tuple(group) for dash, group in grouped if not dash)