def symbol_by_name(name, aliases={}, imp=None, package=None,<EOL>sep='<STR_LIT:.>', default=None, **kwargs):
if imp is None:<EOL><INDENT>imp = importlib.import_module<EOL><DEDENT>if not isinstance(name, six.string_types):<EOL><INDENT>return name                                 <EOL><DEDENT>name = aliases.get(name) or name<EOL>sep = '<STR_LIT::>' if '<STR_LIT::>' in name else sep<EOL>module_name, _, cls_name = name.rpartition(sep)<EOL>if not module_name:<EOL><INDENT>cls_name, module_name = None, package if package else cls_name<EOL><DEDENT>try:<EOL><INDENT>try:<EOL><INDENT>module = imp(module_name, package=package, **kwargs)<EOL><DEDENT>except ValueError as exc:<EOL><INDENT>raise ValueError("<STR_LIT>" % (name, exc))<EOL><DEDENT>return getattr(module, cls_name) if cls_name else module<EOL><DEDENT>except (ImportError, AttributeError):<EOL><INDENT>if default is None:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>return default<EOL>
Get symbol by qualified name.

    The name should be the full dot-separated path to the class::

        modulename.ClassName

    Example::

        celery.concurrency.processes.TaskPool
                                    ^- class name

    or using ':' to separate module and symbol::

        celery.concurrency.processes:TaskPool

    If `aliases` is provided, a dict containing short name/long name
    mappings, the name is looked up in the aliases first.

    Examples:

        >>> symbol_by_name("celery.concurrency.processes.TaskPool")
        <class 'celery.concurrency.processes.TaskPool'>

        >>> symbol_by_name("default", {
        ...     "default": "celery.concurrency.processes.TaskPool"})
        <class 'celery.concurrency.processes.TaskPool'>

        # Does not try to look up non-string names.
        >>> from celery.concurrency.processes import TaskPool
        >>> symbol_by_name(TaskPool) is TaskPool
        True