docs: def finder(target, matchlist, foldermode=0, regex=False, recursive=True):
      """
      function for finding files/folders in folders and their subdirectories
  
      Parameters
      ----------
      target: str or list of str
          a directory, zip- or tar-archive or a list of them to be searched
      matchlist: list
          a list of search patterns
      foldermode: int
          * 0: only files
          * 1: files and folders
          * 2: only folders
      regex: bool
          are the search patterns in matchlist regular expressions or unix shell standard (default)?
      recursive: bool
          search target recursively into all subdirectories or only in the top level?
          This is currently only implemented for parameter `target` being a directory.
  
      Returns
      -------
      list of str
          the absolute names of files/folders matching the patterns
      """
      if foldermode not in [0, 1, 2]:
          raise ValueError("'foldermode' must be either 0, 1 or 2")
      
      # match patterns
      if isinstance(target, str):
          
          pattern = r'|'.join(matchlist if regex else [fnmatch.translate(x) for x in matchlist])
          
          if os.path.isdir(target):
              if recursive:
                  out = dissolve([[os.path.join(root, x)
                                   for x in dirs + files
                                   if re.search(pattern, x)]
                                  for root, dirs, files in os.walk(target)])
              else:
                  out = [os.path.join(target, x)
                         for x in os.listdir(target)
                         if re.search(pattern, x)]
              
              if foldermode == 0:
                  out = [x for x in out if not os.path.isdir(x)]
              if foldermode == 2:
                  out = [x for x in out if os.path.isdir(x)]
              
              return sorted(out)
          
          elif os.path.isfile(target):
              if zf.is_zipfile(target):
                  with zf.ZipFile(target, 'r') as zip:
                      out = [os.path.join(target, name)
                             for name in zip.namelist()
                             if re.search(pattern, os.path.basename(name.strip('/')))]
                  
                  if foldermode == 0:
                      out = [x for x in out if not x.endswith('/')]
                  elif foldermode == 1:
                      out = [x.strip('/') for x in out]
                  elif foldermode == 2:
                      out = [x.strip('/') for x in out if x.endswith('/')]
                  
                  return sorted(out)
              
              elif tf.is_tarfile(target):
                  tar = tf.open(target)
                  out = [name for name in tar.getnames()
                         if re.search(pattern, os.path.basename(name.strip('/')))]
                  
                  if foldermode == 0:
                      out = [x for x in out if not tar.getmember(x).isdir()]
                  elif foldermode == 2:
                      out = [x for x in out if tar.getmember(x).isdir()]
                  
                  tar.close()
                  
                  out = [os.path.join(target, x) for x in out]
                  
                  return sorted(out)
              
              else:
                  raise TypeError("if parameter 'target' is a file, "
                                  "it must be a zip or tar archive:\n    {}"
                                  .format(target))
          else:
              raise TypeError("if parameter 'target' is of type str, "
                              "it must be a directory or a file:\n    {}"
                              .format(target))
      
      elif isinstance(target, list):
          groups = [finder(x, matchlist, foldermode, regex, recursive) for x in target]
          return list(itertools.chain(*groups))
      
      else:
          raise TypeError("parameter 'target' must be of type str or list")