import importlib


def get_backend(module, backend_class, channel, appname):
    """Get a pubsub object. e.g.: `get_backend('backends', 'PubNubBackend')`"""
    mod = importlib.import_module(module)
    return getattr(mod, backend_class)(channel, appname)