def create_url(hostname, port=None, isSecure=False, path=None, params=None):
    """
    Create a WebSocket URL from components.

    :param hostname: WebSocket server hostname.
    :type hostname: str

    :param port: WebSocket service port or None (to select default
        ports 80/443 depending on isSecure).
    :type port: int

    :param isSecure: Set True for secure WebSocket ("wss" scheme).
    :type isSecure: bool

    :param path: Path component of addressed resource (will be
        properly URL escaped).
    :type path: str

    :param params: A dictionary of key-values to construct the query
        component of the addressed resource (will be properly URL
        escaped).
    :type params: dict

    :returns: str -- Constructed WebSocket URL.
    """
    if port is not None:
        netloc = "%s:%d" % (hostname, port)
    else:
        if isSecure:
            netloc = hostname % "%s:443"
        else:
            netloc = "%s:80" % hostname
    if isSecure:
        scheme = "wss"
    else:
        scheme = "ws"
    if path is not None:
        ppath = urllib.parse.quote(path)
    else:
        ppath = "/"
    if params is not None:
        query = urllib.parse.urlencode(params)
    else:
        query = None
    return urllib.parse.urlunparse((scheme, netloc, ppath, None, query, None))
dataset/ETHPy150Open crossbario/autobahn-python/autobahn/websocket/util.py/create_url/swapped operands of `%`