'Get next message for channel name and run appointed consumer'

def consume(self, channel, fail_on_none=True):

    message = self.get_next_message(channel)
    if message:
        match = self.channel_layer.router.match(message)
        if match:
            (consumer, kwargs) = match
            try:
                consumer_started.send(sender=self.__class__)
                return consumer(message, **kwargs)
            except ChannelSocketException as e:
                e.run(message)
            finally:
                consumer_finished.disconnect(close_old_connections)
                consumer_finished.send(sender=self.__class__)
                consumer_finished.connect(close_old_connections)
        elif fail_on_none:
            raise AssertionError((u"Can't    find    consumer    for    message    %s" % message))
    elif fail_on_none:
        raise AssertionError((u'No    message    for    channel    %s' % channel))
