async def _on_rpc_command(self, event):
        """Received an RPC command that we should execute."""

        payload = event['payload']
        rpc_id = payload['rpc_id']
        tag = payload['response_uuid']
        args = payload['payload']

        result = 'success'
        response = b''

        if self._rpc_dispatcher is None or not self._rpc_dispatcher.has_rpc(rpc_id):
            result = 'rpc_not_found'
        else:
            try:
                response = self._rpc_dispatcher.call_rpc(rpc_id, args)
                if inspect.iscoroutine(response):
                    response = await response
            except RPCInvalidArgumentsError:
                result = 'invalid_arguments'
            except RPCInvalidReturnValueError:
                result = 'invalid_response'
            except Exception: #pylint:disable=broad-except;We are being called in a background task
                self._logger.exception("Exception handling RPC 0x%04X", rpc_id)
                result = 'execution_exception'

        message = dict(response_uuid=tag, result=result, response=response)

        try:
            await self.send_command(OPERATIONS.CMD_RESPOND_RPC, message,
                                    MESSAGES.RespondRPCResponse)
        except:  #pylint:disable=bare-except;We are being called in a background worker
            self._logger.exception("Error sending response to RPC 0x%04X", rpc_id)
Received an RPC command that we should execute.