def get_command_class_from_apps(name, apps, exclude_packages=None, exclude_command_class=None):
    """
    Searches through the given apps to find the named command class. Skips
    over any packages specified by exclude_packages and any command class
    specified by exclude_command_class. Returns the last command class found
    or None if the command class could not be found.
    
    Django's command searching behavior is backwards with respect to other
    features like template and static file loaders. This function follows
    that convention.
    
    """
    if exclude_packages is None:
        exclude_packages = []
    for app in reversed(
        [app for app in apps if not issubpackage(app, exclude_packages)]):
        try:
            command_class = import_module(
                "{app:s}.management.commands.{name:s}".format(
                    app=app, name=name)).Command
        except (ImportError, __HOLE__):
            pass
        else:
            if exclude_command_class is None or \
                not issubclass(command_class, exclude_command_class):
                return command_class
    return None
dataset/ETHPy150Open skibblenybbles/django-commando/commando/management/base.py/get_command_class_from_apps