import logging

logger = logging.getLogger(__name__)


class Result():
    def __init__(self, id=None):
        self.id = id
        self.ok = True

    def ok(self):
        return self.ok


class BadResult(Result):
    def __init__(self):
        super().__init__()
        self.ok = False


class Bus():
    def __init__(self):
        self.handlers = {}

    def register(self, command, handler):
        self.handlers[command] = handler

    def send(self, command):
        command_type = type(command)
        if command_type not in self.handlers:
            raise (Exception('No handler for command ' + str(command_type) + ' found'))

        try:
            id = self.handlers[command_type].handle(command)
            return Result(id)
        except Exception as e:
            logger.exception(e)
            return BadResult()
@@ -87,16 +87,17 @@
 _(self, 
+u
 id=None)
@@ -116,16 +116,17 @@
 lf.id = 
+u
 id%0A     
@@ -664,16 +664,17 @@
         
+u
 id = sel
@@ -740,16 +740,17 @@
  Result(
+u
 id)%0A    

refactor shadow name