##### 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 self._dirtree:
            self._init_dirtree()
        if '.' not in filename:  
            extensionless_re = re.compile(r'^{0}(\..+)?$'.format(re.escape(filename)))
            
            try:
                
                filepath = next(os.path.join(r, f) for r, f in self._dirtree if extensionless_re.match(f))
            except StopIteration:
                raise IOError("couldn't find {0}".format(filename))
        else:  
            
            try:
                filepath = next(os.path.join(r, f) for r, f in self._dirtree if f == filename)
            except StopIteration:
                raise IOError("couldn't find {0}".format(filename))
        return filepath
    def get_data(self, filename):
        found_file = self.find_file(filename)
        with open(found_file, 'rb') as fd:
            return fd.read()
def get_collection_role_path(role_name, collection_list=None):