##### SUMMARY
The collection loader currently imports a number of things from Ansible, the heaviest of which is config/constants. This makes it heavyweight and somewhat dangerous for ansible-test and unit tests to use. Refactor it to minimize those imports and supply the necessary impls another way (constructor, DI pattern, etc).

##### ISSUE TYPE
- Feature Idea

##### COMPONENT NAME
AnsibleCollectionLoader

##### ADDITIONAL INFORMATION

if not shell_type:
        
        shell_type = 'sh'
        
        if executable:
            if isinstance(executable, string_types):
                shell_filename = os.path.basename(executable)
                try:
                    shell = shell_loader.get(shell_filename)
                except Exception:
                    shell = None
                if shell is None:
                    for shell in shell_loader.all():
                        if shell_filename in shell.COMPATIBLE_SHELLS:
                            shell_type = shell.SHELL_FAMILY
                            break
        else:
            raise AnsibleError("Either a shell type or a shell executable must be provided ")
    shell = shell_loader.get(shell_type)
    if not shell:
        raise AnsibleError("Could not find the shell plugin required (%s)." % shell_type)
    if executable:
        setattr(shell, 'executable', executable)
    return shell
def add_dirs_to_loader(which_loader, paths):
    loader = getattr(sys.modules[__name__], '%s_loader' % which_loader)
    for path in paths:
        loader.add_directory(path, with_subdir=True)
class PluginLoader: