A restricted implementation of grep in Python.