code: def error(self, message):
      
      # subcommands_quoted is the same as subcommands, except each value is
      # surrounded with double quotes. This is done to match the standard
      # output of the ArgumentParser, while hiding commands we don't want users
      # to use, as they are no longer documented and only here for legacy use.
      subcommands_quoted = ', '.join(
          [repr(command) for command in _VISIBLE_COMMANDS])
      subcommands = ', '.join(_VISIBLE_COMMANDS)
      message = re.sub(
          r'(argument {%s}: invalid choice: .*) \(choose from (.*)\)$'
          % subcommands, r'\1 (choose from %s)' % subcommands_quoted, message)
      super(_EndpointsParser, self).error(message)
docs: Override superclass to support customized error message.
  
      Error message needs to be rewritten in order to display visible commands
      only, when invalid command is called by user. Otherwise, hidden commands
      will be displayed in stderr, which is not expected.
  
      Refer the following argparse python documentation for detailed method
      information:
        http://docs.python.org/2/library/argparse.html#exiting-methods
  
      Args:
        message: original error message that will be printed to stderr