nodes: 0, module; 1, function_definition; 2, function_name:symmetric_difference; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, for_statement; 16, expression_statement; 17, return_statement; 18, comment:r"""Return a new set with elements in either the set or other but not both.
  
          >>> ms = Multiset('aab')
          >>> sorted(ms.symmetric_difference('abc'))
          ['a', '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')
          >>> sorted(ms ^ Multiset('aaac'))
          ['a', 'b', 'c']
  
          For a variant of the operation which modifies the multiset in place see
          :meth:`symmetric_difference_update`.
  
          Args:
              other: The other set to take the symmetric difference with. 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 symmetric difference multiset.
          """; 19, assignment; 20, assignment; 21, assignment; 22, assignment; 23, assignment; 24, assignment; 25, assignment; 26, identifier:element; 27, identifier:dist_elements; 28, block; 29, assignment; 30, identifier:result; 31, identifier:other; 32, call; 33, identifier:result; 34, call; 35, identifier:_total; 36, integer:0; 37, identifier:_elements; 38, attribute; 39, identifier:self_elements; 40, attribute; 41, identifier:other_elements; 42, attribute; 43, identifier:dist_elements; 44, binary_operator:set(self_elements.keys()) | set(other_elements.keys()); 45, expression_statement; 46, expression_statement; 47, expression_statement; 48, expression_statement; 49, if_statement; 50, attribute; 51, identifier:_total; 52, attribute; 53, argument_list; 54, attribute; 55, argument_list; 56, identifier:result; 57, identifier:_elements; 58, identifier:self; 59, identifier:_elements; 60, identifier:other; 61, identifier:_elements; 62, call; 63, call; 64, assignment; 65, assignment; 66, assignment; 67, augmented_assignment; 68, comparison_operator:new_multiplicity > 0; 69, block; 70, identifier:result; 71, identifier:_total; 72, identifier:self; 73, identifier:_as_multiset; 74, identifier:other; 75, identifier:self; 76, identifier:__class__; 77, identifier:set; 78, argument_list; 79, identifier:set; 80, argument_list; 81, identifier:multiplicity; 82, call; 83, identifier:other_multiplicity; 84, call; 85, identifier:new_multiplicity; 86, parenthesized_expression; 87, identifier:_total; 88, identifier:new_multiplicity; 89, identifier:new_multiplicity; 90, integer:0; 91, expression_statement; 92, call; 93, call; 94, attribute; 95, argument_list; 96, attribute; 97, argument_list; 98, conditional_expression:multiplicity - other_multiplicity
                                  if multiplicity > other_multiplicity else other_multiplicity - multiplicity; 99, assignment; 100, attribute; 101, argument_list; 102, attribute; 103, argument_list; 104, identifier:self_elements; 105, identifier:get; 106, identifier:element; 107, integer:0; 108, identifier:other_elements; 109, identifier:get; 110, identifier:element; 111, integer:0; 112, binary_operator:multiplicity - other_multiplicity; 113, comparison_operator:multiplicity > other_multiplicity; 114, binary_operator:other_multiplicity - multiplicity; 115, subscript; 116, identifier:new_multiplicity; 117, identifier:self_elements; 118, identifier:keys; 119, identifier:other_elements; 120, identifier:keys; 121, identifier:multiplicity; 122, identifier:other_multiplicity; 123, identifier:multiplicity; 124, identifier:other_multiplicity; 125, identifier:other_multiplicity; 126, identifier:multiplicity; 127, identifier:_elements; 128, identifier:element
code: def symmetric_difference(self, other):
          r"""Return a new set with elements in either the set or other but not both.
  
          >>> ms = Multiset('aab')
          >>> sorted(ms.symmetric_difference('abc'))
          ['a', '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')
          >>> sorted(ms ^ Multiset('aaac'))
          ['a', 'b', 'c']
  
          For a variant of the operation which modifies the multiset in place see
          :meth:`symmetric_difference_update`.
  
          Args:
              other: The other set to take the symmetric difference with. 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 symmetric difference multiset.
          """
          other = self._as_multiset(other)
          result = self.__class__()
          _total = 0
          _elements = result._elements
          self_elements = self._elements
          other_elements = other._elements
          dist_elements = set(self_elements.keys()) | set(other_elements.keys())
          for element in dist_elements:
              multiplicity = self_elements.get(element, 0)
              other_multiplicity = other_elements.get(element, 0)
              new_multiplicity = (multiplicity - other_multiplicity
                                  if multiplicity > other_multiplicity else other_multiplicity - multiplicity)
              _total += new_multiplicity
              if new_multiplicity > 0:
                  _elements[element] = new_multiplicity
          result._total = _total
          return result