code: def first(self):
          
          try:
              return next(self.data(sorted_by='energy', name='Sample'))
          except StopIteration:
              raise ValueError('{} is empty'.format(self.__class__.__name__))
docs: Sample with the lowest-energy.
  
          Raises:
              ValueError: If empty.
  
          Example:
  
              >>> sampleset = dimod.ExactSolver().sample_ising({'a': 1}, {('a', 'b'): 1})
              >>> sampleset.first
              Sample(sample={'a': -1, 'b': 1}, energy=-2.0, num_occurrences=1)