def patfilter(names, pat):
 if (pat not in _pat_cache):
  _pat_cache[pat] = re.compile(_translate_pattern(pat))
 match = _pat_cache[pat].match
 return list(filter(match, names))

def patfilter ( names , pat ) : if ( pat not in _pat_cache ) : _pat_cache [ pat ] = re . compile ( _translate_pattern ( pat ) ) match = _pat_cache [ pat ] . match return list ( filter ( match , names ) )
return the subset of the list names that match pat .