<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _adopt_notifications(self, state):
        '''Part of the "monitor" restart strategy. The pending notifications
        from descriptor of dead agent are imported to our pending list.'''

        def iterator():
            it = state.descriptor.pending_notifications.iteritems()
            for _, nots in it:
                for x in nots:
                    yield x

        to_adopt = list(iterator())
        self.info("Will adopt %d pending notifications.", len(to_adopt))
        return state.sender.notify(to_adopt)