'Creates listeners specified by self.listeners; overwrites existing
listeners on these ports; removes extraneous listeners'

def _set_elb_listeners(self):

    listeners_to_add = []
    listeners_to_remove = []
    listeners_to_keep = []
    for listener in self.listeners:
        listener_as_tuple = self._listener_as_tuple(listener)
        existing_listener_found = None
        for existing_listener in self.elb.listeners:
            if (existing_listener[0] == int(listener['load_balancer_port'])):
                existing_listener_found = self._api_listener_as_tuple(existing_listener)
                break
        if existing_listener_found:
            if (listener_as_tuple != existing_listener_found):
                listeners_to_remove.append(existing_listener_found)
                listeners_to_add.append(listener_as_tuple)
            else:
                listeners_to_keep.append(existing_listener_found)
        else:
            listeners_to_add.append(listener_as_tuple)
    if self.purge_listeners:
        for existing_listener in self.elb.listeners:
            existing_listener_tuple = self._api_listener_as_tuple(existing_listener)
            if (existing_listener_tuple in listeners_to_remove):
                continue
            if (existing_listener_tuple in listeners_to_keep):
                continue
            listeners_to_remove.append(existing_listener_tuple)
    if listeners_to_remove:
        self._delete_elb_listeners(listeners_to_remove)
    if listeners_to_add:
        self._create_elb_listeners(listeners_to_add)
