def METHOD_NAME(pat, case_sensitive):
    if isinstance(pat, bytes):
        pat_str = pat.decode('ISO-8859-1')
        res_str = translate(pat_str)
        res = res_str.encode('ISO-8859-1')
    else:
        res = translate(pat)
    flags = 0 if case_sensitive else re.IGNORECASE
    return re.compile(res, flags).match