code: def register_rules(self, rules):
      
      if not isinstance(rules, Iterable):
        raise TypeError('The rules must be an iterable, given {!r}'.format(rules))
  
      # "Index" the rules to normalize them and expand their dependencies.
      normalized_rules = RuleIndex.create(rules).normalized_rules()
      indexed_rules = normalized_rules.rules
      union_rules = normalized_rules.union_rules
  
      # Store the rules and record their dependency Optionables.
      self._rules.update(indexed_rules)
      self._union_rules.update(union_rules)
      dependency_optionables = {do
                                for rule in indexed_rules
                                for do in rule.dependency_optionables
                                if rule.dependency_optionables}
      self.register_optionables(dependency_optionables)
docs: Registers the given rules.
  
      param rules: The rules to register.
      :type rules: :class:`collections.Iterable` containing
                   :class:`pants.engine.rules.Rule` instances.