'Turns the consumer from a string into an object if it\'s a string,
passes it through otherwise.'

def _resolve_consumer(self, consumer):

    if isinstance(consumer, six.string_types):
        (module_name, variable_name) = consumer.rsplit(u'.', 1)
        try:
            consumer = getattr(importlib.import_module(module_name), variable_name)
        except (ImportError, AttributeError):
            raise ImproperlyConfigured((u'Cannot    import    consumer    %r' % consumer))
    return consumer
