<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_item(self, item):
 """Main item handler. Called by queue listener. """

        logger.debug("Processing item: %s (queue size: %s)", item,
                     self.queue.qsize())
        method, kwargs = item

        if method not in self.supported_methods:
            raise Error("Not expected service method: {}".format(method))

        try:
            if method == "log":
                self.process_log(**kwargs)
            else:
                self._post_log_batch()
                getattr(self.rp_client, method)(**kwargs)
        except Exception:
            if self.error_handler:
                self.error_handler(sys.exc_info())
            else:
                self.terminate(nowait=True)
                raise