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

def cancel_pending_requests(self):
        '''Cancel all pending requests.'''
        exception = CancelledError()
        for _request, event in self._requests.values():
            event.result = exception
            event.set()
        self._requests.clear()