<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def first(self):
 """Sample with the lowest-energy. Raises: ValueError: If empty. Example: Sample(sample={'a': -1, 'b': 1}, energy=-2.0, num_occurrences=1) """

        try:
            return next(self.data(sorted_by='energy', name='Sample'))
        except StopIteration:
            raise ValueError('{} is empty'.format(self.__class__.__name__))