code: def fix_variable(self, v, value):
          
          adj = self.adj
          linear = self.linear
  
          if value not in self.vartype.value:
              raise ValueError("expected value to be in {}, received {} instead".format(self.vartype.value, value))
  
          removed_interactions = []
          for u in adj[v]:
              self.add_variable(u, value * adj[v][u])
              removed_interactions.append((u, v))
          self.remove_interactions_from(removed_interactions)
  
          self.add_offset(value * linear[v])
          self.remove_variable(v)
docs: Fix the value of a variable and remove it from a binary quadratic model.
  
          Args:
              v (variable):
                  Variable in the binary quadratic model to be fixed.
  
              value (int):
                  Value assigned to the variable. Values must match the :class:`.Vartype` of the binary
                  quadratic model.
  
          Examples:
  
              This example creates a binary quadratic model with one variable and fixes
              its value.
  
              >>> import dimod
              ...
              >>> bqm = dimod.BinaryQuadraticModel({'a': -.5, 'b': 0.}, {('a', 'b'): -1}, 0.0, dimod.SPIN)
              >>> bqm.fix_variable('a', -1)
              >>> bqm.offset
              0.5
              >>> bqm.linear['b']
              1.0
              >>> 'a' in bqm
              False