<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def errorReceived(self, merr):
 """ Called when an error message is received """

        d, timeout = self._pendingCalls.get(merr.reply_serial, (None, None))
        if timeout:
            timeout.cancel()
        if d:
            del self._pendingCalls[merr.reply_serial]
            e = error.RemoteError(merr.error_name)
            e.message = ''
            e.values = []
            if merr.body:
                if isinstance(merr.body[0], six.string_types):
                    e.message = merr.body[0]
                e.values = merr.body
            d.errback(e)