code: def prune_files(path, name):
      """Utility for safely selecting only relevant files"""
      if isinstance(path, str):
          files = [
              os.path.join(path, f)
              for f in os.listdir(path)
              if name == ".".join(f.split(".")[:-3])
          ]
          files = [pickle_load(f) for f in sorted(files)]
      elif isinstance(path, list):
          files = [
              tup[1]
              for tup in sorted(path, key=lambda x: x[0])
              if name == ".".join(tup[0].split(".")[:-2])
          ]
      else:
          raise ValueError(
              "Expected name of cache or cache list. Got %r" % path
          )
      return files
  
file_path: mlens/mlens/parallel/_base_functions.py
imports: from __future__ import division
  import os
  import warnings
  from scipy.sparse import issparse
  import numpy
  from ..utils import pickle_load, pickle_save, load
  from ..utils.exceptions import MetricWarning, ParameterChangeWarning
label_desc: Use image node_id 3 for calling a global function with example usage: prune_files(path, name) and returns: files