code: def GenericPump(filenames, use_jppy=False, name="GenericPump", **kwargs):
      if isinstance(filenames, str):
          filenames = [filenames]
      try:
          iter(filenames)
      except TypeError:
          log.critical("Don't know how to iterate through filenames.")
          raise TypeError("Invalid filenames.")
      extensions = set(os.path.splitext(fn)[1] for fn in filenames)
      if len(extensions) > 1:
          log.critical("Mixed filetypes, please use only files of the same type")
          raise IOError("Mixed filetypes.")
      extension = list(extensions)[0]
      io = {
          '.evt': EvtPump,
          '.h5': HDF5Pump,
          '.root': EventPump if use_jppy else AanetPump,
          '.dat': DAQPump,
          '.dqd': CLBPump,
      }
      if extension not in io:
          log.critical(
              "No pump found for file extension '{0}'".format(extension)
          )
          raise ValueError("Unknown filetype")
      missing_files = [fn for fn in filenames if not os.path.exists(fn)]
      if missing_files:
          if len(missing_files) == len(filenames):
              message = "None of the given files could be found."
              log.critical(message)
              raise SystemExit(message)
          else:
              log.warning(
                  "The following files are missing and ignored: {}".format(
                      ', '.join(missing_files)
                  )
              )
      input_files = set(filenames) - set(missing_files)
      if len(input_files) == 1:
          return io[extension](filename=filenames[0], name=name, **kwargs)
      else:
          return io[extension](filenames=filenames, name=name, **kwargs)