def read_client_registrations(body, defhost=None, defport=None):
    """Yield client registrations (as Endpoints) from an encoded registration
    message body. The message format is one registration per line, with each
    line being encoded as application/x-www-form-urlencoded. The key "client" is
    required and contains the client address and port (perhaps filled in by
    defhost and defport). The key "client-transport" is optional and defaults to
    "websocket".
    Example:
      client=1.2.3.4:9000&client-transport=websocket
      client=1.2.3.4:9090&client-transport=obfs3|websocket
    """
    for line in body.splitlines():
        qs = urlparse.parse_qs(line, keep_blank_values=True, strict_parsing=True)
        # Get the unique value associated with the given key in qs. If the key
        # is absent or appears more than once, raise ValueError.
        def get_unique(key, default=None):
            try:
                vals = qs[key]
            except KeyError:
                if default is None:
                    raise ValueError("missing %r key" % key)
                vals = (default,)
            if len(vals) != 1:
                raise ValueError("more than one %r key" % key)
            return vals[0]
        addr = parse_addr_spec(get_unique("client"), defhost, defport)
        transport = get_unique("client-transport", DEFAULT_CLIENT_TRANSPORT)
        yield reg.Endpoint(addr, transport)
dataset/ETHPy150Open arlolra/flashproxy/flashproxy/fac.py/read_client_registrations/original