

def get_open_port():
    sock = socket.socket()
    sock.bind(('', 0))
    port = sock.getsockname()[1]
    sock.close()
    return port

dataset/ETHPy150Open dpkp/kafka-python/test/testutil.py get_open_port/original