docs: def _set_rules(self, rules: dict, overwrite=True):
          """Created a new Rules object based on the provided dict of rules."""
  
          if not isinstance(rules, dict):
              raise TypeError('rules must be an instance of dict or Rules,'
                              'got %r instead' % type(rules))
  
          if overwrite:
              self.rules = Rules(rules, self.default_rule)
          else:
              self.rules.update(rules)