code: def parse(cls, args):
          
  
          try:
              (options, args) = cls.optparser.parse_args(args)
              if options.mode not in ["1", "2"]:
                  raise ParseError("mode must be either '1' or '2'",
                                   cls.optparser.format_help())
  
              if (options.dbtap_id is None) or (options.db_table is None):
                  raise ParseError("dbtap_id and db_table are required",
                                   cls.optparser.format_help())
  
              if options.mode is "1":
                  if options.hive_table is None:
                      raise ParseError("hive_table is required for mode 1",
                                       cls.optparser.format_help())
              elif options.export_dir is None:    # mode 2
                  raise ParseError("export_dir is required for mode 2",
                                   cls.optparser.format_help())
  
              if options.db_update_mode is not None:
                  if options.db_update_mode not in ["allowinsert", "updateonly"]:
                      raise ParseError("db_update_mode should either be left blank for append "
                                       "mode or be 'updateonly' or 'allowinsert'",
                                       cls.optparser.format_help())
                  if options.db_update_mode is "updateonly":
                      if options.db_update_keys is None:
                          raise ParseError("db_update_keys is required when db_update_mode "
                                           "is 'updateonly'",
                                           cls.optparser.format_help())
                  elif options.db_update_keys is not None:
                      raise ParseError("db_update_keys is used only when db_update_mode "
                                       "is 'updateonly'",
                                       cls.optparser.format_help())
  
          except OptionParsingError as e:
              raise ParseError(e.msg, cls.optparser.format_help())
          except OptionParsingExit as e:
              return None
  
          v = vars(options)
          v["command_type"] = "DbExportCommand"
          return v
docs: Parse command line arguments to construct a dictionary of command
          parameters that can be used to create a command
  
          Args:
              `args`: sequence of arguments
  
          Returns:
              Dictionary that can be used in create method
  
          Raises:
              ParseError: when the arguments are not correct