def get_free_tcp_port():
    tcp = old_socket(socket.AF_INET, socket.SOCK_STREAM)
    tcp.bind(('', 0))
    host, port = tcp.getsockname()
    tcp.close()
    return port
Same with core layouts
dataset/ETHPy150Open gabrielfalcao/HTTPretty/tests/functional/base.py/get_free_tcp_port--crossover with--dataset/ETHPy150Open rwl/muntjac/muntjac/addon/weelayout/wee_layout_application.py/WeelayoutApplication.createCoreVertical