def re_tester(regex, flags=0):
    """Creates a predicate testing passed string with regex."""
    if not isinstance(regex, _re_type):
        regex = re.compile(regex, flags)
    return lambda s: bool(regex.search(s))
Creates a predicate testing passed string with regex.
funcy/strings.py