def handle_single(a):
    if (type(a) == Macro):
        self._run_macro(a.code)
    elif (type(a) == Command):
        self._send_command(a.command)
    elif (type(a) == Exception):
        raise a
    else:
        raise Exception('Internal Error: invalid action type. Should be Macro, Command or Exception')
def handle_single(a):
    if (type(a) == Macro):
        self._run_macro(a.code)
    elif (type(a) == Command):
        self._send_command(a.command)
    elif (type(a) == Exception):
        raise a
    else:
        raise Exception('Internal Error: invalid action type. Should be Macro, Command or Exception')