nodes: 0, module; 1, function_definition; 2, function_name:times_update; 3, parameters; 4, block; 5, identifier:self; 6, identifier:factor; 7, expression_statement; 8, if_statement; 9, comment:"""Update each this multiset by multiplying each element's multiplicity with the given scalar factor.
  
          >>> ms = Multiset('aab')
          >>> ms.times_update(2)
          >>> sorted(ms)
          ['a', 'a', 'a', 'a', 'b', 'b']
  
          You can also use the ``*=`` operator for the same effect:
  
          >>> ms = Multiset('ac')
          >>> ms *= 3
          >>> sorted(ms)
          ['a', 'a', 'a', 'c', 'c', 'c']
  
          For a variant of the operation which does not modify the multiset, but returns a new
          multiset instead see :meth:`times`.
  
          Args:
              factor: The factor to multiply each multiplicity with.
          """; 10, comparison_operator:factor < 0; 11, block; 12, elif_clause; 13, else_clause; 14, identifier:factor; 15, integer:0; 16, raise_statement; 17, comparison_operator:factor == 0; 18, block; 19, block; 20, call; 21, identifier:factor; 22, integer:0; 23, expression_statement; 24, expression_statement; 25, for_statement; 26, expression_statement; 27, identifier:ValueError; 28, argument_list; 29, call; 30, assignment; 31, identifier:element; 32, identifier:_elements; 33, block; 34, augmented_assignment; 35, string:"The factor must not be negative."; 36, attribute; 37, argument_list; 38, identifier:_elements; 39, attribute; 40, expression_statement; 41, attribute; 42, identifier:factor; 43, identifier:self; 44, identifier:clear; 45, identifier:self; 46, identifier:_elements; 47, augmented_assignment; 48, identifier:self; 49, identifier:_total; 50, subscript; 51, identifier:factor; 52, identifier:_elements; 53, identifier:element
code: def times_update(self, factor):
          """Update each this multiset by multiplying each element's multiplicity with the given scalar factor.
  
          >>> ms = Multiset('aab')
          >>> ms.times_update(2)
          >>> sorted(ms)
          ['a', 'a', 'a', 'a', 'b', 'b']
  
          You can also use the ``*=`` operator for the same effect:
  
          >>> ms = Multiset('ac')
          >>> ms *= 3
          >>> sorted(ms)
          ['a', 'a', 'a', 'c', 'c', 'c']
  
          For a variant of the operation which does not modify the multiset, but returns a new
          multiset instead see :meth:`times`.
  
          Args:
              factor: The factor to multiply each multiplicity with.
          """
          if factor < 0:
              raise ValueError("The factor must not be negative.")
          elif factor == 0:
              self.clear()
          else:
              _elements = self._elements
              for element in _elements:
                  _elements[element] *= factor
              self._total *= factor