code: def _bin(g):
      
      new_rules = []
      for rule in g.rules:
          if len(rule.rhs) > 2:
              new_rules += _split(rule)
          else:
              new_rules.append(rule)
      return Grammar(new_rules)
docs: Applies the BIN rule to 'g' (see top comment).