code: def scale(self, scalar, ignored_variables=None, ignored_interactions=None,
                ignore_offset=False):
          
  
          if ignored_variables is None:
              ignored_variables = set()
          elif not isinstance(ignored_variables, abc.Container):
              ignored_variables = set(ignored_variables)
  
          if ignored_interactions is None:
              ignored_interactions = set()
          elif not isinstance(ignored_interactions, abc.Container):
              ignored_interactions = set(ignored_interactions)
  
          linear = self.linear
          for v in linear:
              if v in ignored_variables:
                  continue
              linear[v] *= scalar
  
          quadratic = self.quadratic
          for u, v in quadratic:
              if (u, v) in ignored_interactions or (v, u) in ignored_interactions:
                  continue
              quadratic[(u, v)] *= scalar
  
          if not ignore_offset:
              self.offset *= scalar
  
          try:
              self._counterpart.scale(scalar, ignored_variables=ignored_variables,
                                      ignored_interactions=ignored_interactions)
          except AttributeError:
              pass
docs: Multiply by the specified scalar all the biases and offset of a binary quadratic model.
  
          Args:
              scalar (number):
                  Value by which to scale the energy range of the binary quadratic model.
  
              ignored_variables (iterable, optional):
                  Biases associated with these variables are not scaled.
  
              ignored_interactions (iterable[tuple], optional):
                  As an iterable of 2-tuples. Biases associated with these interactions are not scaled.
  
              ignore_offset (bool, default=False):
                  If True, the offset is not scaled.
  
          Examples:
  
              This example creates a binary quadratic model and then scales it to half
              the original energy range.
  
              >>> import dimod
              ...
              >>> bqm = dimod.BinaryQuadraticModel({'a': -2.0, 'b': 2.0}, {('a', 'b'): -1.0}, 1.0, dimod.SPIN)
              >>> bqm.scale(0.5)
              >>> bqm.linear['a']
              -1.0
              >>> bqm.quadratic[('a', 'b')]
              -0.5
              >>> bqm.offset
              0.5