def compile_pattern(pat, subentries_match=None):
    """Translate and compile a glob pattern to a regular expression matcher.
    Parameters:
        pat: string
            The pattern to compile
        subentries_match: boolean
            When true, acts as if
    """
    if isinstance(pat, bytes):
        pat_str = pat.decode('ISO-8859-1')
        res_str = translate_glob(os.path.normcase(pat_str), subentries_match=subentries_match)
        res = res_str.encode('ISO-8859-1')
    else:
        res = translate_glob(os.path.normcase(pat), subentries_match=subentries_match)
    return re.compile(res).match
Translate and compile a glob pattern to a regular expression matcher.
    Parameters:
        pat: string
            The pattern to compile
        subentries_match: boolean
            When true, acts as if
    
src/globmatch/translation.py