Factory that creates an bot config from an entry in INSTALLED_APPS.

def create(cls, entry):
        """
        Factory that creates an bot config from an entry in INSTALLED_APPS.
        """
        # trading_bots.example.bot.ExampleBot
        try:
            # If import_module succeeds, entry is a path to a bot module,
            # which may specify a bot class with a default_bot attribute.
            # Otherwise, entry is a path to a bot class or an error.
            module = import_module(entry)

        except ImportError:
            # Track that importing as a bot module failed. If importing as a
            # bot class fails too, we'll trigger the ImportError again.
            module = None

            mod_path, _, cls_name = entry.rpartition('.')

            # Raise the original exception when entry cannot be a path to an
            # bot config class.
            if not mod_path:
                raise

        else:
            try:
                # If this works, the bot module specifies a bot class.
                entry = module.default_bot
            except AttributeError:
                # Otherwise, it simply uses the default bot registry class.
                return cls(f'{entry}.Bot', module)
            else:
                mod_path, _, cls_name = entry.rpartition('.')

        # If we're reaching this point, we must attempt to load the bot
        # class located at <mod_path>.<cls_name>
        mod = import_module(mod_path)
        try:
            bot_cls = getattr(mod, cls_name)
        except AttributeError:
            if module is None:
                # If importing as an bot module failed, that error probably
                # contains the most informative traceback. Trigger it again.
                import_module(entry)
            raise

        # Check for obvious errors. (This check prevents duck typing, but
        # it could be removed if it became a problem in practice.)
        if not issubclass(bot_cls, Bot):
            raise ImproperlyConfigured(
                "'%s' isn't a subclass of Bot." % entry)

        # Entry is a path to an bot config class.
        return cls(entry, mod, bot_cls.label)