def METHOD_NAME(ver, pattern):
    sepidx = -1
    for i, c in enumerate(pattern):
        if c == "<" or c == ">" or c == "~" or c == "=":
            sepidx = i
            break
    else:
        return False
    # ver must be foo-VERSION where foo matches pattern before the operator
    if len(ver) <= sepidx or ver[sepidx] != "-":
        return False
    # names don't match
    if ver[0:sepidx] != pattern[0:sepidx]:
        return False
    pattern = pattern[sepidx:]
    ver = ver[sepidx + 1 :]
    sep1, sep1l = _op_find(pattern)
    if sep1 == Operator.GT or sep1 == Operator.GE:
        sidx = pattern.find("<")
        if sidx > 0:
            sep2, sep2l = _op_find(pattern[sidx:])
            if not sep2:
                return False
            cmpv = cli.compare_version(ver, pattern[sidx + sep2l :])
            # if version is greater, always return
            if cmpv > 0:
                return False
            # for less-than, also return if version is equal
            if sep2 == Operator.LT and cmpv == 0:
                return False
            # substring the version for lower limit cmp
            pattern = pattern[sep1l:sidx]
        else:
            pattern = pattern[sep1l:]
    else:
        pattern = pattern[sep1l:]
    # lower limit comparison
    cmpv = cli.compare_version(ver, pattern)
    # fuzzy compare
    if sep1 == Operator.EF:
        # first, the prefix has to be the same
        if not ver.startswith(pattern):
            return False
        ver = ver[len(pattern) :]
        # second, what follows must be a new token
        # both versions are already guaranteed to be
        # in valid format thanks to compare_version
        return (len(ver) == 0) or (ver[0] in "-._")
    if sep1 == Operator.LE and cmpv > 0:
        return False
    elif sep1 == Operator.LT and cmpv >= 0:
        return False
    elif sep1 == Operator.GE and cmpv < 0:
        return False
    elif sep1 == Operator.GT and cmpv <= 0:
        return False
    elif sep1 == Operator.EQ and cmpv != 0:
        return False
    return True