import socketserver


def get_free_tcp_port(host: str = "localhost") -> int:
    """Returns an available TCP port"""
    with socketserver.TCPServer((host, 0), socketserver.BaseRequestHandler) as s:
        return s.server_address[1]