'Remove dependencies that are not currently used.
Returns a list of all environments that have been successfully removed.'

def remove_unused_dependency_paths(self, envs):

    envs_to_remove = set(envs)
    toolbox_requirements_status = self.toolbox_requirements_status
    removed_environments = set()
    for resolver in self._dependency_resolvers:
        if (hasattr(resolver, 'unused_dependency_paths') and hasattr(resolver, 'uninstall_environments')):
            unused_dependencies = resolver.unused_dependency_paths(toolbox_requirements_status)
            can_remove = (envs_to_remove & set(unused_dependencies))
            exit_code = resolver.uninstall_environments(can_remove)
            if (exit_code == 0):
                removed_environments = removed_environments.union(can_remove)
                envs_to_remove = envs_to_remove.difference(can_remove)
    return list(removed_environments)
