def ex_create_listener(self, balancer, backend_port, protocol, algorithm,
                           bandwidth, **kwargs):
        """
        Create load balancer listening rule.

        :param balancer: the balancer which the rule belongs to.
                         The listener created will listen on the port of the
                         the balancer as default. 'ListenerPort' in kwargs
                         will *OVERRIDE* it.
        :type balancer: ``LoadBalancer``

        :param backend_port: the backend server port
        :type backend_port: ``int``

        :param protocol: the balancer protocol, default to http
        :type protocol: ``str``

        :param algorithm: the balancer routing algorithm
        :type algorithm: ``Algorithm``

        :param bandwidth: the listener bandwidth limits
        :type bandwidth: ``str``

        :return: the created listener
        :rtype: ``SLBLoadBalancerListener``
        """

        cls = PROTOCOL_TO_LISTENER_MAP.get(protocol,
                                           SLBLoadBalancerHttpListener)
        if 'ListenerPort' in kwargs:
            port = kwargs['ListenerPort']
        else:
            port = balancer.port
        listener = cls.create(port, backend_port, algorithm,
                              bandwidth, extra=kwargs)
        params = listener.get_create_params()
        params['LoadBalancerId'] = balancer.id
        params['RegionId'] = self.region
        resp = self.connection.request(self.path, params)
        return resp.success()
dataset/ETHPy150Open apache/libcloud/libcloud/loadbalancer/drivers/slb.py/SLBDriver.ex_create_listener/original