nodes: 0, module; 1, function_definition; 2, function_name:difference; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, return_statement; 14, identifier:others; 15, comment:r"""Return a new multiset with all elements from the others removed.
  
          >>> ms = Multiset('aab')
          >>> sorted(ms.difference('bc'))
          ['a', 'a']
  
          You can also use the ``-`` operator for the same effect. However, the operator version
          will only accept a set as other operator, not any iterable, to avoid errors.
  
          >>> ms = Multiset('aabbbc')
          >>> sorted(ms - Multiset('abd'))
          ['a', 'b', 'b', 'c']
  
          For a variant of the operation which modifies the multiset in place see
          :meth:`difference_update`.
  
          Args:
              others: The other sets to remove from the multiset. Can also be any :class:`~typing.Iterable`\[~T]
                  or :class:`~typing.Mapping`\[~T, :class:`int`] which are then converted to :class:`Multiset`\[~T].
  
          Returns:
              The resulting difference multiset.
          """; 16, assignment; 17, assignment; 18, assignment; 19, identifier:other; 20, call; 21, block; 22, assignment; 23, identifier:result; 24, identifier:result; 25, call; 26, identifier:_elements; 27, attribute; 28, identifier:_total; 29, attribute; 30, identifier:map; 31, argument_list; 32, for_statement; 33, attribute; 34, identifier:_total; 35, attribute; 36, argument_list; 37, identifier:result; 38, identifier:_elements; 39, identifier:result; 40, identifier:_total; 41, attribute; 42, identifier:others; 43, pattern_list; 44, call; 45, block; 46, identifier:result; 47, identifier:_total; 48, identifier:self; 49, identifier:__copy__; 50, identifier:self; 51, identifier:_as_multiset; 52, identifier:element; 53, identifier:multiplicity; 54, attribute; 55, argument_list; 56, if_statement; 57, identifier:other; 58, identifier:items; 59, comparison_operator:element in _elements; 60, block; 61, identifier:element; 62, identifier:_elements; 63, expression_statement; 64, expression_statement; 65, if_statement; 66, assignment; 67, assignment; 68, comparison_operator:new_multiplicity > 0; 69, block; 70, else_clause; 71, identifier:old_multiplicity; 72, subscript; 73, identifier:new_multiplicity; 74, binary_operator:old_multiplicity - multiplicity; 75, identifier:new_multiplicity; 76, integer:0; 77, expression_statement; 78, expression_statement; 79, block; 80, identifier:_elements; 81, identifier:element; 82, identifier:old_multiplicity; 83, identifier:multiplicity; 84, assignment; 85, augmented_assignment; 86, delete_statement; 87, expression_statement; 88, subscript; 89, identifier:new_multiplicity; 90, identifier:_total; 91, identifier:multiplicity; 92, subscript; 93, augmented_assignment; 94, identifier:_elements; 95, identifier:element; 96, identifier:_elements; 97, identifier:element; 98, identifier:_total; 99, identifier:old_multiplicity
code: def difference(self, *others):
          r"""Return a new multiset with all elements from the others removed.
  
          >>> ms = Multiset('aab')
          >>> sorted(ms.difference('bc'))
          ['a', 'a']
  
          You can also use the ``-`` operator for the same effect. However, the operator version
          will only accept a set as other operator, not any iterable, to avoid errors.
  
          >>> ms = Multiset('aabbbc')
          >>> sorted(ms - Multiset('abd'))
          ['a', 'b', 'b', 'c']
  
          For a variant of the operation which modifies the multiset in place see
          :meth:`difference_update`.
  
          Args:
              others: The other sets to remove from the multiset. Can also be any :class:`~typing.Iterable`\[~T]
                  or :class:`~typing.Mapping`\[~T, :class:`int`] which are then converted to :class:`Multiset`\[~T].
  
          Returns:
              The resulting difference multiset.
          """
          result = self.__copy__()
          _elements = result._elements
          _total = result._total
          for other in map(self._as_multiset, others):
              for element, multiplicity in other.items():
                  if element in _elements:
                      old_multiplicity = _elements[element]
                      new_multiplicity = old_multiplicity - multiplicity
                      if new_multiplicity > 0:
                          _elements[element] = new_multiplicity
                          _total -= multiplicity
                      else:
                          del _elements[element]
                          _total -= old_multiplicity
          result._total = _total
          return result