def _matches(self, tape):
        '''iterate through rules returning first match'''
        for rule in self.rulebase:
            for i in find_all(tape, rule.lhs):
                return i, rule
        return False, None
iterate through rules returning first match
recipes/Python/578087_Useful_Unrestricted_Grammar_/recipe-578087.py