def _comp(u, v, tcomp):
    """
    Overloaded comparator for comparing
    two values where any one of them can be
    `None`.
    """
    if u is None and v is not None:
        return False
    elif u is not None and v is None:
        return True
    elif u is None and v is None:
        return False
    else:
        return tcomp(u, v)