import socket


def get_available_port(default_port):
    """Find an available port to bind to."""
    port = default_port
    with socket.socket() as s:
        while True:
            try:
                s.bind(("127.0.0.1", port))
            except OSError:
                port += 1
            else:
                break

    return port