code: def _ParseStringOption(cls, options, argument_name, default_value=None):
      
      argument_value = getattr(options, argument_name, None)
      if argument_value is None:
        return default_value
  
      if isinstance(argument_value, py2to3.BYTES_TYPE):
        encoding = sys.stdin.encoding
  
        # Note that sys.stdin.encoding can be None.
        if not encoding:
          encoding = locale.getpreferredencoding()
        if not encoding:
          encoding = cls._PREFERRED_ENCODING
  
        try:
          argument_value = argument_value.decode(encoding)
        except UnicodeDecodeError as exception:
          raise errors.BadConfigOption((
              'Unable to convert option: {0:s} to Unicode with error: '
              '{1!s}.').format(argument_name, exception))
  
      elif not isinstance(argument_value, py2to3.UNICODE_TYPE):
        raise errors.BadConfigOption(
            'Unsupported option: {0:s} string type required.'.format(
                argument_name))
  
      return argument_value
docs: Parses a string command line argument.
  
      Args:
        options (argparse.Namespace): parser options.
        argument_name (str): name of the command line argument.
        default_value (Optional[str]): default value of the command line argument.
  
      Returns:
        str: command line argument value or the default value if the command line
            argument is not set
  
      Raises:
        BadConfigOption: if the command line argument value cannot be converted
            to a Unicode string.