def clean_semver(cls, version_spec):
        return re.sub(r"([<>=~])\s+?v?", "\\1", version_spec, re.IGNORECASE)
def _globpatsplit(pat):
    """Split a glob pattern. Return a list.

    A naive version is "path.split("/")". This function handles more cases, like
    "{*,{a,b}*/*}".

    >>> _globpatsplit("*/**/x/{a,b/c}")
    ['*', '**', 'x', '{a,b/c}']
    """
    result = []
    buf = ""
    parentheses = 0
    for ch in pat:
        if ch == "{":
            parentheses += 1
        elif ch == "}":
            parentheses -= 1
        if parentheses == 0 and ch == "/":
            if buf:
                result.append(buf)
                buf = ""
        else:
            buf += ch
    if buf:
        result.append(buf)
    return result