nodes: 0, module; 1, function_definition; 2, function_name:union_update; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, identifier:others; 13, comment:r"""Update the multiset, adding elements from all others using the maximum multiplicity.
  
          >>> ms = Multiset('aab')
          >>> ms.union_update('bc')
          >>> sorted(ms)
          ['a', 'a', 'b', 'c']
  
          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('aab')
          >>> ms |= Multiset('bccd')
          >>> sorted(ms)
          ['a', 'a', 'b', 'c', 'c', 'd']
  
          For a variant of the operation which does not modify the multiset, but returns a new
          multiset instead see :meth:`union`.
  
          Args:
              others: The other sets to union this multiset with. Can also be any :class:`~typing.Iterable`\[~T]
                  or :class:`~typing.Mapping`\[~T, :class:`int`] which are then converted to :class:`Multiset`\[~T].
          """; 14, assignment; 15, assignment; 16, identifier:other; 17, call; 18, block; 19, assignment; 20, identifier:_elements; 21, attribute; 22, identifier:_total; 23, attribute; 24, identifier:map; 25, argument_list; 26, for_statement; 27, attribute; 28, identifier:_total; 29, identifier:self; 30, identifier:_elements; 31, identifier:self; 32, identifier:_total; 33, attribute; 34, identifier:others; 35, pattern_list; 36, call; 37, block; 38, identifier:self; 39, identifier:_total; 40, identifier:self; 41, identifier:_as_mapping; 42, identifier:element; 43, identifier:multiplicity; 44, attribute; 45, argument_list; 46, expression_statement; 47, if_statement; 48, identifier:other; 49, identifier:items; 50, assignment; 51, comparison_operator:multiplicity > old_multiplicity; 52, block; 53, identifier:old_multiplicity; 54, call; 55, identifier:multiplicity; 56, identifier:old_multiplicity; 57, expression_statement; 58, expression_statement; 59, attribute; 60, argument_list; 61, assignment; 62, augmented_assignment; 63, identifier:_elements; 64, identifier:get; 65, identifier:element; 66, integer:0; 67, subscript; 68, identifier:multiplicity; 69, identifier:_total; 70, binary_operator:multiplicity - old_multiplicity; 71, identifier:_elements; 72, identifier:element; 73, identifier:multiplicity; 74, identifier:old_multiplicity
code: def union_update(self, *others):
          r"""Update the multiset, adding elements from all others using the maximum multiplicity.
  
          >>> ms = Multiset('aab')
          >>> ms.union_update('bc')
          >>> sorted(ms)
          ['a', 'a', 'b', 'c']
  
          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('aab')
          >>> ms |= Multiset('bccd')
          >>> sorted(ms)
          ['a', 'a', 'b', 'c', 'c', 'd']
  
          For a variant of the operation which does not modify the multiset, but returns a new
          multiset instead see :meth:`union`.
  
          Args:
              others: The other sets to union this multiset with. Can also be any :class:`~typing.Iterable`\[~T]
                  or :class:`~typing.Mapping`\[~T, :class:`int`] which are then converted to :class:`Multiset`\[~T].
          """
          _elements = self._elements
          _total = self._total
          for other in map(self._as_mapping, others):
              for element, multiplicity in other.items():
                  old_multiplicity = _elements.get(element, 0)
                  if multiplicity > old_multiplicity:
                      _elements[element] = multiplicity
                      _total += multiplicity - old_multiplicity
          self._total = _total