nodes: 0, module; 1, function_definition; 2, function_name:intersection; 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 elements common to the multiset and all others.
  
          >>> ms = Multiset('aab')
          >>> sorted(ms.intersection('abc'))
          ['a', 'b']
  
          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')
          >>> sorted(ms & Multiset('aaac'))
          ['a', 'a']
  
          For a variant of the operation which modifies the multiset in place see
          :meth:`intersection_update`.
  
          Args:
              others: The other sets intersect with 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 multiset resulting from the intersection of the sets.
          """; 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_mapping; 52, identifier:element; 53, identifier:multiplicity; 54, identifier:list; 55, argument_list; 56, expression_statement; 57, if_statement; 58, call; 59, assignment; 60, comparison_operator:new_multiplicity < multiplicity; 61, block; 62, attribute; 63, argument_list; 64, identifier:new_multiplicity; 65, call; 66, identifier:new_multiplicity; 67, identifier:multiplicity; 68, if_statement; 69, identifier:_elements; 70, identifier:items; 71, attribute; 72, argument_list; 73, comparison_operator:new_multiplicity > 0; 74, block; 75, else_clause; 76, identifier:other; 77, identifier:get; 78, identifier:element; 79, integer:0; 80, identifier:new_multiplicity; 81, integer:0; 82, expression_statement; 83, expression_statement; 84, block; 85, assignment; 86, augmented_assignment; 87, delete_statement; 88, expression_statement; 89, subscript; 90, identifier:new_multiplicity; 91, identifier:_total; 92, binary_operator:multiplicity - new_multiplicity; 93, subscript; 94, augmented_assignment; 95, identifier:_elements; 96, identifier:element; 97, identifier:multiplicity; 98, identifier:new_multiplicity; 99, identifier:_elements; 100, identifier:element; 101, identifier:_total; 102, identifier:multiplicity
code: def intersection(self, *others):
          r"""Return a new multiset with elements common to the multiset and all others.
  
          >>> ms = Multiset('aab')
          >>> sorted(ms.intersection('abc'))
          ['a', 'b']
  
          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')
          >>> sorted(ms & Multiset('aaac'))
          ['a', 'a']
  
          For a variant of the operation which modifies the multiset in place see
          :meth:`intersection_update`.
  
          Args:
              others: The other sets intersect with 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 multiset resulting from the intersection of the sets.
          """
          result = self.__copy__()
          _elements = result._elements
          _total = result._total
          for other in map(self._as_mapping, others):
              for element, multiplicity in list(_elements.items()):
                  new_multiplicity = other.get(element, 0)
                  if new_multiplicity < multiplicity:
                      if new_multiplicity > 0:
                          _elements[element] = new_multiplicity
                          _total -= multiplicity - new_multiplicity
                      else:
                          del _elements[element]
                          _total -= multiplicity
          result._total = _total
          return result