def get_port(msg, excluded_ports=[]):
    """
    Receives port from the user, and returns it.
    Makes sure that the port is valid
    """
    port = None

    # Get a port from the user while the port is invalid
    while port is None:
        try:
            port = int(input(msg))

            # Check if the port is in the list of excluded ports
            if port in excluded_ports:
                print("You chose an excluded port.")
                port = None
        except:
            print("Invalid port. Try entering a number between 1 - 65535")
    return port