<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rex(expr):
 """ Regular expression matcher to use together with transform functions """

    r = re.compile(expr)
    return lambda key: isinstance(key, six.string_types) and r.match(key)