class_docstr: Memory context to provide caching for interfaces
  
  Parameters
  ==========
  base_dir: string
      The directory name of the location for the caching
  
  Methods
  =======
  cache
      Creates a cacheable function from an nipype Interface class
  clear_previous_runs
      Removes from the disk all the runs that where not used after
      the creation time of the specific Memory instance
  clear_previous_runs
      Removes from the disk all the runs that where not used after
      the given time
class_docstr_tok: ["Memory","context","to","provide","caching","for","interfaces","Parameters","==========","base_dir",":","string","The","directory","name","of","the","location","for","the","caching","Methods","=======","cache","Creates","a","cacheable","function","from","an","nipype","Interface","class","clear_previous_runs","Removes","from","the","disk","all","the","runs","that","where","not","used","after","the","creation","time","of","the","specific","Memory","instance","clear_previous_runs","Removes","from","the","disk","all","the","runs","that","where","not","used","after","the","given","time"]
docstr: Remove all the runs apart from those given to the function
  input.
docstr_tok: ["Remove","all","the","runs","apart","from","those","given","to","the","function","input","."]
code: def _clear_all_but(self, runs, warn=True):
      """Remove all the runs apart from those given to the function
      input.
      """
      rm_all_but(self.base_dir, set(runs.keys()), warn=warn)
      for dir_name, job_names in list(runs.items()):
          rm_all_but(
              os.path.join(self.base_dir, dir_name),
              job_names,
              warn=warn,
          )
  
imports: import os
  import hashlib
  import pickle
  import time
  import shutil
  import glob
  from ..interfaces.base import BaseInterface
  from ..pipeline.engine import Node
  from ..pipeline.engine.utils import modify_paths
label_desc: Use image node_id 6 for calling the Memory obj's underlying member method code with example usage: obj._clear_all_but(runs, warn) without return types