code: def _filenames_from_arg(filename):
      
      if isinstance(filename, string_types):
          filenames = [filename]
      elif isinstance(filename, (list, tuple)):
          filenames = filename
      else:
          raise Exception('filename argument must be string, list or tuple')
      for fn in filenames:
          if not os.path.exists(fn):
              raise ValueError('file not found: %s' % fn)
          if not os.path.isfile(fn):
              raise ValueError('not a file: %s' % fn)
      return filenames
docs: Utility function to deal with polymorphic filenames argument.