code: def collectfiles(path, filt=None):
      
      if not os.path.isdir(path):
          path = os.path.dirname(path)
  
      output = []
      for name in sorted(os.listdir(path)):
          filepath = os.path.join(path, name)
          if os.path.isfile(filepath):
              if not filt or filt(name):
                  output.append((name, filepath))
      return output
docs: Collects some files based on the given filename.
      
      :param      path | <str>
                  filt | <method>
          
      :return     [(<str> name, <str> filepath), ..]