code: def poly_energy(sample_like, poly):
      
  
      msg = ("poly_energy is deprecated and will be removed in dimod 0.9.0."
             "In the future, use BinaryPolynomial.energy")
      warnings.warn(msg, DeprecationWarning)
      # dev note the vartype is not used in the energy calculation and this will
      # be deprecated in the future
      return BinaryPolynomial(poly, 'SPIN').energy(sample_like)
docs: Calculates energy of a sample from a higher order polynomial.
  
      Args:
           sample (samples_like):
              A raw sample. `samples_like` is an extension of NumPy's
              array_like structure. See :func:`.as_samples`.
  
          poly (dict):
              Polynomial as a dict of form {term: bias, ...}, where `term` is a
              tuple of variables and `bias` the associated bias.
  
      Returns:
          float: The energy of the sample.