def socketpair(family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0):
    # We create a connected TCP socket. Note the trick with setblocking(0)
    # that prevents us from having to create a thread.
    lsock = socket.socket(family, type, proto)
    lsock.bind(('localhost', 0))
    lsock.listen(1)
    addr, port = lsock.getsockname()
    csock = socket.socket(family, type, proto)
    csock.setblocking(True)
    try:
        csock.connect((addr, port))
    except Exception:
        lsock.close()
        csock.close()
        raise
    ssock, _ = lsock.accept()
    csock.setblocking(True)
    lsock.close()
    return (ssock, csock)
Strip out some of the dictionary fields.
dataset/ETHPy150Open quantmind/pulsar/pulsar/utils/system/windowssystem.py/socketpair--crossover with--dataset/ETHPy150Open j-bennet/wharfee/wharfee/formatter.py/filter_dict