code: def parse_args(pargs=None):
      parser = argparse.ArgumentParser(
          formatter_class=argparse.ArgumentDefaultsHelpFormatter,
          description="Rewrite formats to BacktraderCSVData format",
      )
  
      parser.add_argument(
          "--format",
          "-fmt",
          required=False,
          choices=DATAFORMATS.keys(),
          default=next(iter(DATAFORMATS)),
          help="File to be read in",
      )
  
      parser.add_argument(
          "--infile", "-i", required=True, help="File to be read in"
      )
  
      parser.add_argument(
          "--outfile",
          "-o",
          default=None,
          required=False,
          help="File to write to",
      )
  
      parser.add_argument(
          "--fromdate",
          "-f",
          required=False,
          help="Starting date in YYYY-MM-DD format",
      )
  
      parser.add_argument(
          "--todate",
          "-t",
          required=False,
          help="Ending date in YYYY-MM-DD format",
      )
  
      parser.add_argument(
          "--separator",
          "-s",
          required=False,
          default=",",
          help="Plot the read data",
      )
  
      # Plot options
      parser.add_argument(
          "--plot",
          "-p",
          nargs="?",
          required=False,
          metavar="kwargs",
          const=True,
          help=(
              "Plot the read data applying any kwargs passed\n"
              "\n"
              "For example:\n"
              "\n"
              '  --plot style="candle" (to plot candles)\n'
          ),
      )
  
      if pargs is not None:
          return parser.parse_args(pargs)
  
      return parser.parse_args()
  
file_path: backtrader/tools/rewrite-data.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import argparse
  import datetime
  import os.path
  import time
  import sys
  import backtrader
  from backtrader.utils.py3 import bytes
label_desc: Use image node_id 2 for calling a global function with example usage: parse_args(pargs) and returns: parser, parser