def forward_device_msg(identity, msg):
    """Forwards a message from plugin->client or client->plugin, editing it to take
    out all identifying information. This way, all identity management stays in
    the router, and plugins/clients talk to each other with no actual knowledge
    of who claims/says what.

    """
    to_alias = msg[0]
    print _ctd
    print _dtc
    to_addr = None
    new_msg = None
    # TODO: Remove [0], make deal with multiclaims. Someday.

    # Plugins aren't allowed to know who owns them, they just see commands from
    # the system. Therefore they set their "to" address as "c", and we replace
    # it with the correct client identity.
    if to_alias == "c":
        new_msg = [identity] + list(msg[1:])
        to_addr = _dtc[identity][0]

    # Client only know their device's provided address (bus address, bluetooth
    # id, etc...). We resolve that to the plugin's socket identity.
    elif _dtc.keys() in to_alias:
        # Plugins don't get to know where things come from. Spooooky.
        new_msg = ["s"] + list(msg[1:])
        to_addr = _ctd[identity][0]
    else:
        logging.warning("No claims between %s and %s!", identity, to_addr)
        return

    logging.debug("Forwarding message %s to %s", new_msg, to_addr)
    queue.add(to_addr, new_msg)
dataset/ETHPy150Open metafetish/buttplug/buttplug/core/plugin.py/forward_device_msg/swapped operands of `in`