code: def _register_rules(self, rule_index):
      
      registered = set()
      for output_type, rules in rule_index.rules.items():
        for rule in rules:
          key = (output_type, rule)
          if key in registered:
            continue
          registered.add(key)
  
          if type(rule) is TaskRule:
            self._register_task(output_type, rule, rule_index.union_rules)
          else:
            raise ValueError('Unexpected Rule type: {}'.format(rule))
docs: Record the given RuleIndex on `self._tasks`.