<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def match(pattern, name):
 # type: (Text, Text) -> bool """Test whether a name matches a wildcard pattern. Arguments: pattern (str):
 A wildcard pattern, e.g. ``"*.py"``. name (str):
 A filename. Returns: bool: `True` if the filename matches the pattern. """

    try:
        re_pat = _PATTERN_CACHE[(pattern, True)]
    except KeyError:
        res = "(?ms)" + _translate(pattern) + r'\Z'
        _PATTERN_CACHE[(pattern, True)] = re_pat = re.compile(res)
    return re_pat.match(name) is not None