docs: def stdio(filters=None, search_dirs=None, data_dir=True, sys_path=True, panfl_=False, input_stream=None, output_stream=None):
      """
      Reads JSON from stdin and second CLI argument:
      ``sys.argv[1]``. Dumps JSON doc to the stdout.
  
      :param filters: Union[List[str], None]
          if None then read from metadata
      :param search_dirs: Union[List[str], None]
          if None then read from metadata
      :param data_dir: bool
      :param sys_path: bool
      :param panfl_: bool
      :param input_stream: io.StringIO or None
          for debug purpose
      :param output_stream: io.StringIO or None
          for debug purpose
      :return: None
      """
      doc = load(input_stream)
      # meta = doc.metadata  # Local variable 'meta' value is not used
      verbose = doc.get_metadata('panflute-verbose', False)
  
      if search_dirs is None:
          # metadata 'panflute-path' can be a list, a string, or missing
          # `search_dirs` should be a list of str
          search_dirs = doc.get_metadata('panflute-path', [])
          if type(search_dirs) != list:
              search_dirs = [search_dirs]
          if '--data-dir' in search_dirs:
              data_dir = True
          if '--no-sys-path' in search_dirs:
              sys_path = False
          search_dirs = [dir_ for dir_ in search_dirs
                         if dir_ not in ('--data-dir', '--no-sys-path')]
  
      if verbose:
          debug('panflute: data_dir={} sys_path={}'.format(data_dir, sys_path))
      search_dirs = [p.normpath(p.expanduser(p.expandvars(dir_))) for dir_ in search_dirs]
  
      if not panfl_:
          # default panflute behaviour:
          search_dirs.append('.')
          if data_dir:
              search_dirs.append(get_filter_dir())
          if sys_path:
              search_dirs += sys.path
      else:
          # panfl/pandoctools behaviour:
          if data_dir:
              search_dirs.append(get_filter_dir())
          if sys_path:
              search_dirs += reduced_sys_path
  
      # Display message (tests that everything is working ok)
      msg = doc.get_metadata('panflute-echo', False)
      if msg:
          debug(msg)
  
      if filters is None:
          # metadata 'panflute-filters' can be a list, a string, or missing
          # `filters` should be a list of str
          filters = doc.get_metadata('panflute-filters', [])
          if type(filters) != list:
              filters = [filters]
  
      if filters:
          if verbose:
              msg = "panflute: will run the following filters:"
              debug(msg, ' '.join(filters))
          doc = autorun_filters(filters, doc, search_dirs, verbose)
      elif verbose:
          debug("panflute: no filters were provided")
  
      dump(doc, output_stream)