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

async def dispatch(self, *args, **kwargs):
        '''
        This method handles the actual request to the resource.
        It performs all the neccesary checks and then executes the relevant member method which is mapped to the method name.
        Handles authentication and de-serialization before calling the required method.
        Handles the serialization of the response
        '''
        method = self.request_method()

        # get the db object associated with the app and assign to resource
        if hasattr(self.request.app, 'db'):
            setattr(self, 'db', self.request.app.db)

        # check if method is allowed
        if method not in self.methods.get(self.endpoint, {}):
            raise MethodNotImplemented("Unsupported method '{0}' for {1} endpoint.".format(method, self.endpoint))

        if self.is_method_allowed(self.endpoint, method) is False:
            raise MethodNotAllowed("Unsupported method '{0}' for {1} endpoint.".format(method, self.endpoint))

        # check user authentication
        if not await self._meta.authentication.is_authenticated(self.request):
            raise Unauthorized()

        # deserialize request data
        body = await self.request_body()
        self.data = self.parse(method, self.endpoint, body)
        # if method != 'GET':
            # self.data.update(kwargs)
        kwargs.update(self.request_args())
        view_method = getattr(self, self.methods[self.endpoint][method])
        # call request method
        data = await view_method(*args, **kwargs)
        # add hypermedia to the response, if response is not empty
        if data and self._meta.hypermedia is True:
            if self.endpoint == 'list' and method == 'GET':
                for item in data['objects']:
                    self.add_hypermedia(item)
            else:
                self.add_hypermedia(data)

        return data