code: def to_hising(self):
          
          if self.vartype is Vartype.BINARY:
              return self.to_spin().to_hising()
  
          h = {}
          J = {}
          offset = 0
          for term, bias in self.items():
              if len(term) == 0:
                  offset += bias
              elif len(term) == 1:
                  v, = term
                  h[v] = bias
              else:
                  J[tuple(term)] = bias
  
          return h, J, offset
docs: Construct a higher-order Ising problem from a binary polynomial.
  
          Returns:
              tuple: A 3-tuple of the form (`h`, `J`, `offset`) where `h` includes
              the linear biases, `J` has the higher-order biases and `offset` is
              the linear offset.
  
          Examples:
              >>> poly = dimod.BinaryPolynomial({'a': -1, 'ab': 1, 'abc': -1}, dimod.SPIN)
              >>> h, J, off = poly.to_hising()
              >>> h
              {'a': -1}