docs: def discard(self, element, multiplicity=None):
          """Removes the `element` from the multiset.
  
          If multiplicity is ``None``, all occurrences of the element are removed:
  
          >>> ms = Multiset('aab')
          >>> ms.discard('a')
          2
          >>> sorted(ms)
          ['b']
  
          Otherwise, the multiplicity is subtracted from the one in the multiset and the
          old multiplicity is removed:
  
          >>> ms = Multiset('aab')
          >>> ms.discard('a', 1)
          2
          >>> sorted(ms)
          ['a', 'b']
  
          In contrast to :meth:`remove`, this does not raise an error if the
          element is not in the multiset:
  
          >>> ms = Multiset('a')
          >>> ms.discard('b')
          0
          >>> sorted(ms)
          ['a']
  
          It is also not an error to remove more elements than are in the set:
  
          >>> ms.remove('a', 2)
          1
          >>> sorted(ms)
          []
  
          Args:
              element:
                  The element to remove from the multiset.
              multiplicity:
                  An optional multiplicity i.e. count of elements to remove.
  
          Returns:
              The multiplicity of the element in the multiset before
              the removal.
          """
          _elements = self._elements
          if element in _elements:
              old_multiplicity = _elements[element]
              if multiplicity is None or multiplicity >= old_multiplicity:
                  del _elements[element]
                  self._total -= old_multiplicity
              elif multiplicity < 0:
                  raise ValueError("Multiplicity must not be negative")
              elif multiplicity > 0:
                  _elements[element] -= multiplicity
                  self._total -= multiplicity
              return old_multiplicity
          else:
              return 0