<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dispatch(self):
 """Calls the matching logic function by request type or intent name."""


        if self.request.request.type == 'IntentRequest':
            name = self.request.request.intent.name
        else:
            name = self.request.request.type

        if name in self.logic:
            self.logic[name]()
        else:
            error = 'Unable to find a registered logic function named: {}'
            raise KeyError(error.format(name))