code: def _commonprefix(files):
      
      out = os.path.commonprefix(files)
      out = out.rstrip("_R")
      out = out.rstrip("_I")
      out = out.rstrip("_")
      return out
docs: Retrieve a common prefix for files without extra _R1 _I1 extensions.
  
      Allows alternative naming schemes (R1/R2/R3) (R1/R2/I1).