nodes: 0, module; 1, function_definition; 2, function_name:discard; 3, parameters; 4, block; 5, identifier:self; 6, identifier:element; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, identifier:multiplicity; 12, None; 13, comment:"""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.
          """; 14, assignment; 15, comparison_operator:element in _elements; 16, block; 17, else_clause; 18, identifier:_elements; 19, attribute; 20, identifier:element; 21, identifier:_elements; 22, expression_statement; 23, if_statement; 24, return_statement; 25, block; 26, identifier:self; 27, identifier:_elements; 28, assignment; 29, boolean_operator; 30, block; 31, elif_clause; 32, elif_clause; 33, identifier:old_multiplicity; 34, return_statement; 35, identifier:old_multiplicity; 36, subscript; 37, comparison_operator:multiplicity is None; 38, comparison_operator:multiplicity >= old_multiplicity; 39, delete_statement; 40, expression_statement; 41, comparison_operator:multiplicity < 0; 42, block; 43, comparison_operator:multiplicity > 0; 44, block; 45, integer:0; 46, identifier:_elements; 47, identifier:element; 48, identifier:multiplicity; 49, None; 50, identifier:multiplicity; 51, identifier:old_multiplicity; 52, subscript; 53, augmented_assignment; 54, identifier:multiplicity; 55, integer:0; 56, raise_statement; 57, identifier:multiplicity; 58, integer:0; 59, expression_statement; 60, expression_statement; 61, identifier:_elements; 62, identifier:element; 63, attribute; 64, identifier:old_multiplicity; 65, call; 66, augmented_assignment; 67, augmented_assignment; 68, identifier:self; 69, identifier:_total; 70, identifier:ValueError; 71, argument_list; 72, subscript; 73, identifier:multiplicity; 74, attribute; 75, identifier:multiplicity; 76, string:"Multiplicity must not be negative"; 77, identifier:_elements; 78, identifier:element; 79, identifier:self; 80, identifier:_total
code: 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