def output_option(self, option):
        default_text = ''

        content = [self.format_content(option.attrs['help'])]

        if 'extended_help' in option.attrs:
            content.append(self.format_content(option.attrs['extended_help']))

        if 'default' in option.attrs:
            action = option.attrs.get('action', 'store')
            default = option.attrs.get('default')

            if action == 'store_true' and default is True:
                default_text = 'This option is set by default.'
            elif action == 'store_false' and default is False:
                default_text = 'This option is set by default.'
            elif action == 'store' and default is not None:
                default_text = ('If not specified, ``%s`` is used by default.'
                                % default)

        if 'config_key' in option.attrs:
            if default_text:
                default_text += (' The default can be changed by setting '
                                 '``%s`` in :file:`.reviewboardrc`.'
                                 % option.attrs['config_key'])
            else:
                default_text = ('The default can be set in ``%s`` in '
                                ':file:`.reviewboardrc`.'
                                % option.attrs['config_key'])

        if default_text:
            content.append(default_text)

        if 'metavar' in option.attrs:
            norm_metavar = option.attrs['metavar'].lower().replace('_', ' ')

            option_args = ', '.join([
                '%s <%s>' % (option_name, norm_metavar)
                for option_name in option.opts
            ])
        elif 'choices' in option.attrs:
            norm_choices = '|'.join(option.attrs['choices'])

            if option.attrs.get('default') is not None:
                norm_choices = '[%s]' % norm_choices
            else:
                norm_choices = '<%s>' % norm_choices

            option_args = ', '.join([
                '%s %s' % (option_name, norm_choices)
                for option_name in option.opts
            ])
        else:
            option_args = ', '.join(option.opts)

        if 'deprecated_in' in option.attrs:
            content.append('.. deprecated:: %s'
                           % option.attrs['deprecated_in'])

        if 'added_in' in option.attrs:
            content.append('.. versionadded:: %s' % option.attrs['added_in'])

        if 'versions_changed' in option.attrs:
            versions_changed = option.attrs['versions_changed']

            for version in sorted(versions_changed, reverse=True):
                content.append(
                    '.. versionchanged:: %s\n%s' % (
                        version,
                        self.indent_content(
                            self.format_content(versions_changed[version]),
                            indent_level=2)))

        node = parse_text(
            self,
            '.. cmdoption:: %s\n\n%s'
            % (option_args, self.indent_content('\n\n'.join(content))))

        return [node]
dataset/ETHPy150Open reviewboard/rbtools/docs/rbtools/_ext/rbt_commands.py/CommandOptionsDirective.output_option/original