def METHOD_NAME(self, rules):
    sc_key = '|'.join(rules)
    sc = self._cached_sc.get(sc_key)
    if sc:
        return sc
    lexicon = [
        (self.get_rule_pattern(n), (n, self.get_rule_method(n)))
        for n in rules
    ]
    sc = self.scanner_cls(lexicon)
    self._cached_sc[sc_key] = sc
    return sc