code: def intersect_files(flist1, flist2):
      
      def fname(abs_path):
          """Returns the filename given an absolute path.
  
          Parameters
          ----------
          abs_path :
  
  
          Returns
          -------
  
          """
          return os.path.splitext(os.path.split(abs_path)[-1])[0]
  
      fmap = dict([(fname(f), f) for f in flist1])
      pairs = [list(), list()]
      for f in flist2:
          if fname(f) in fmap:
              pairs[0].append(fmap[fname(f)])
              pairs[1].append(f)
  
      return pairs
docs: Return the intersection of two sets of filepaths, based on the file name
      (after the final '/') and ignoring the file extension.
  
      Examples
      --------
       >>> flist1 = ['/a/b/abc.lab', '/c/d/123.lab', '/e/f/xyz.lab']
       >>> flist2 = ['/g/h/xyz.npy', '/i/j/123.txt', '/k/l/456.lab']
       >>> sublist1, sublist2 = mir_eval.util.intersect_files(flist1, flist2)
       >>> print sublist1
       ['/e/f/xyz.lab', '/c/d/123.lab']
       >>> print sublist2
       ['/g/h/xyz.npy', '/i/j/123.txt']
  
      Parameters
      ----------
      flist1 : list
          first list of filepaths
      flist2 : list
          second list of filepaths
  
      Returns
      -------
      sublist1 : list
          subset of filepaths with matching stems from ``flist1``
      sublist2 : list
          corresponding filepaths from ``flist2``