import re


def version(v):
    """Use this function to compare string-based version numbers.

    >>> '3.0.7' < '3.0.11'
    False
    >>> lib.base3.version('3.0.7') < lib.base3.version('3.0.11')
    True
    >>> lib.base3.version('v3.0.7-2') < lib.base3.version('3.0.11')
    True
    >>> lib.base3.version(psutil.__version__) >= lib.base3.version('5.3.0')
    True

    Parameters
    ----------
    v : str
        A version string.

    Returns
    -------
    tuple
        A tuple of version numbers.
    """
    # if we get something like "v0.10.7-2", remove everything except "." and "-",
    # and convert "-" to "."
    v = re.sub(r'[^0-9\.-]', '', v)
    v = v.replace('-', '.')
    return tuple(map(int, (v.split("."))))