code: def from_ising(cls, h, J, offset=0.0):
          
          if isinstance(h, abc.Sequence):
              h = dict(enumerate(h))
  
          return cls(h, J, offset, Vartype.SPIN)
docs: Create a binary quadratic model from an Ising problem.
  
  
          Args:
              h (dict/list):
                  Linear biases of the Ising problem. If a dict, should be of the
                  form `{v: bias, ...}` where v is a spin-valued variable and `bias`
                  is its associated bias. If a list, it is treated as a list of
                  biases where the indices are the variable labels.
  
              J (dict[(variable, variable), bias]):
                  Quadratic biases of the Ising problem.
  
              offset (optional, default=0.0):
                  Constant offset applied to the model.
  
          Returns:
              :class:`.BinaryQuadraticModel`: Binary quadratic model with vartype set to
              :class:`.Vartype.SPIN`.
  
          Examples:
              This example creates a binary quadratic model from an Ising problem.
  
              >>> import dimod
              >>> h = {1: 1, 2: 2, 3: 3, 4: 4}
              >>> J = {(1, 2): 12, (1, 3): 13, (1, 4): 14,
              ...      (2, 3): 23, (2, 4): 24,
              ...      (3, 4): 34}
              >>> model = dimod.BinaryQuadraticModel.from_ising(h, J, offset = 0.0)
              >>> model      # doctest: +SKIP
              BinaryQuadraticModel({1: 1, 2: 2, 3: 3, 4: 4}, {(1, 2): 12, (1, 3): 13, (1, 4): 14, (2, 3): 23, (3, 4): 34, (2, 4): 24}, 0.0, Vartype.SPIN)