<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pending_confirmations(self):
 """Return all published messages that have yet to be acked, nacked, or returned. :return: [(int, Published)] """

        return sorted([(idx, msg)
                       for idx, msg in enumerate(self.published_messages)
                       if not msg.future.done()],
                      key=lambda x: x[1].delivery_tag)