def METHOD_NAME(self, module: nn.Module, output_paths: list):
    """
    Recursively prune the module to support all provided output_paths but remove all redundant layers
    """
    last_index = -1
    last_key = None
    # look for the last key from all paths
    for path in output_paths:
        key = path[0] if isinstance(path, (list, ListConfig)) else path
        index = list(module._modules).index(str(key))
        if index > last_index:
            last_index = index
            last_key = key
    module._modules = self._slice_odict(module._modules, 0, last_index + 1)
    next_level_paths = []
    for path in output_paths:
        if isinstance(path, (list, ListConfig)) and path[0] == last_key and len(path) > 1:
            next_level_paths.append(path[1:])
    if len(next_level_paths) > 0:
        self.METHOD_NAME(module._modules[str(last_key)], next_level_paths)