<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, method_frame):
        '''
        Dispatch a method for this protocol.
        '''
        method = self.dispatch_map.get(method_frame.method_id)
        if method:
            callback = self.channel.clear_synchronous_cb(method)
            callback(method_frame)
        else:
            raise self.InvalidMethod(
                "no method is registered with id: %d" % method_frame.method_id)