<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _prune(self):
 """Shorten hypotheses to the best k ones."""

        self.hypotheses = sorted(self.hypotheses,
                                 key=lambda e: e['probability'],
                                 reverse=True)[:self.k]