code: def valid_file(value):
      
      if not value:
          raise argparse.ArgumentTypeError("'' is not a valid file path")
      elif not os.path.exists(value):
          raise argparse.ArgumentTypeError(
              "%s is not a valid file path" % value)
      elif os.path.isdir(value):
          raise argparse.ArgumentTypeError(
              "%s is a directory, not a regular file" % value)
      return value
docs: Check if given file exists and is a regular file.
  
      Args:
          value (str): path to the file.
  
      Raises:
          argparse.ArgumentTypeError: if not valid.
  
      Returns:
          str: original value argument.