def send_action(name, action, *args, **kwargs):
    """
    Send an action to a listener
    the listener must have a 'dispatch_{action}' method
    or this will raise a ChalmersError
    """

    addr = get_addr(name)
    try:
        c = Client(addr, family=EventDispatcher.FAMILY)
    except (socket.error, WindowsError):
        raise errors.ConnectionError(name % "Could not connect to chalmers program %s")

    try:
        c.send({'action': action, 'args':args, 'kwargs':kwargs})
        res = c.recv()

        if res.get('error'):
            raise errors.ChalmersError(res.get('message', 'Unknown error'))
        return res.get('result')
    finally:
        c.close()
dataset/ETHPy150Open Anaconda-Platform/chalmers/chalmers/event_dispatcher.py/send_action/swapped operands of `%`