def any_match(match_fn, seq, patterns):
    """Return True if match_fn(s, pat) is true for some (s, pat) in seq x patterns
    match_fn: seq x patterns -> bool,
    seq, patterns: iterables, generators.

    Equality:
    >>> any_match(lambda x, y: x == y, (1, 2, 3), (5, 6, 1))
    True
    >>> any_match(lambda x, y: x == y, (1, 2, 3), (5, 6))
    False

    fnmatch.fnmatchcase (fnmatch.fnmatchcase is case-sensitive)
    >>> import fnmatch
    >>> names = (s for s in ('pair', 'P.pair', 'pair.getter', 'P.pair.getter'))
    >>> patterns = ('pair', )
    >>> any_match(fnmatch.fnmatchcase, names, patterns)
    True
    >>> any_match(fnmatch.fnmatchcase, names, patterns) # names generator is now 'spent', list(names) is empty
    False

    Regexp
    >>> import re
    >>> patterns = (r'a.*b', r'[0-9]{2,2}[a-z]')
    >>> matcher = lambda s, pat: re.match(pat, s)
    >>> any_match(matcher, ('aaaa', 'bbb', '0q'), patterns)
    False
    >>> any_match(matcher, ('aaaab',), patterns)
    True
    >>> any_match(matcher, ('aa', '23z'), patterns)
    True
    """
    return any(
        match_fn(s, pat)
        for s in seq
        for pat in patterns
    )