import re


def grep(source, pattern):
    """Run regex PATTERN over each line in SOURCE and return
    True if any match found"""
    found = False
    p = re.compile(pattern)
    for line in source:
        if p.match(line):
            found = True
            break
    return found