code: def add(self, pattern: Pattern, label=None) -> None:
          
          if label is None:
              label = pattern
          for i, (p, l, _) in enumerate(self.patterns):
              if pattern == p and label == l:
                  return i
          # TODO: Avoid renaming in the pattern, use variable indices instead
          renaming = self._collect_variable_renaming(pattern.expression) if self.rename else {}
          self._internal_add(pattern, label, renaming)
docs: Add a new pattern to the matcher.
  
          The optional label defaults to the pattern itself and is yielded during matching. The same pattern can be
          added with different labels which means that every match for the pattern will result in every associated label
          being yielded with that match individually.
  
          Equivalent patterns with the same label are not added again. However, patterns that are structurally equivalent,
          but have different constraints or different variable names are distinguished by the matcher.
  
          Args:
              pattern:
                  The pattern to add.
              label:
                  An optional label for the pattern. Defaults to the pattern itself.