Repository: yt-dlp/yt-dlp
File: yt_dlp/options.py (Python)

Code before:
        return self.check_values(self.values, self.largs)

    def _generate_error_message(self, msg):
        msg = f'{self.get_prog_name()}: error: {str(msg).strip()}\n'
        return f'{self.get_usage()}\n{msg}' if self.usage else msg

    def error(self, msg):
        raise optparse.OptParseError(self._generate_error_message(msg))

    def _get_args(self, args):
        return sys.argv[1:] if args is None else list(args)

    def _match_long_opt(self, opt):
        """Improve ambiguous argument resolution by comparing option objects instead of argument strings"""
        try:
            return super()._match_long_opt(opt)
        except optparse.AmbiguousOptionError as e:
            if len({self._long_opt[p] for p in e.possibilities}) == 1:
                return e.possibilities[0]
            raise

    def format_option_help(self, formatter=None):
        assert formatter, 'Formatter can not be None'
        formatted_help = super().format_option_help(formatter=formatter)
        formatter.indent()
        heading = formatter.format_heading('Preset aliases')
        formatter.indent()
        result = []
        for name, args in _PRESET_ALIASES.items():
            option = optparse.Option('-t', help=shlex.join(args))
            formatter.option_strings[option] = f'-t {name}'
            result.append(formatter.format_option(option))
        formatter.dedent()
        formatter.dedent()
        help_lines = '\n'.join(result)
        return f'{formatted_help}\n{heading}{help_lines}'


def create_parser():
    def _list_from_options_callback(option, opt_str, value, parser, append=True, delim=',', process=str.strip):
        # append can be True, False or -1 (prepend)
        current = list(getattr(parser.values, option.dest)) if append else []
        value = list(filter(None, [process(value)] if delim is None else map(process, value.split(delim))))
        setattr(
            parser.values, option.dest,
            current + value if append is True else value + current)

    def _set_from_options_callback(
            option, opt_str, value, parser, allowed_values, delim=',', aliases={},
            process=lambda x: x.lower().strip()):
        values = [process(value)] if delim is None else map(process, value.split(delim))

Review comment (suggestion):
to be consistent with other headings
```suggestion
        heading = formatter.format_heading('Preset Aliases')
```

Code after:
        return self.check_values(self.values, self.largs)

    def _generate_error_message(self, msg):
        msg = f'{self.get_prog_name()}: error: {str(msg).strip()}\n'
        return f'{self.get_usage()}\n{msg}' if self.usage else msg

    def error(self, msg):
        raise optparse.OptParseError(self._generate_error_message(msg))

    def _get_args(self, args):
        return sys.argv[1:] if args is None else list(args)

    def _match_long_opt(self, opt):
        """Improve ambiguous argument resolution by comparing option objects instead of argument strings"""
        try:
            return super()._match_long_opt(opt)
        except optparse.AmbiguousOptionError as e:
            if len({self._long_opt[p] for p in e.possibilities}) == 1:
                return e.possibilities[0]
            raise

    def format_option_help(self, formatter=None):
        assert formatter, 'Formatter can not be None'
        formatted_help = super().format_option_help(formatter=formatter)
        formatter.indent()
        heading = formatter.format_heading('Preset Aliases')
        formatter.indent()
        result = []
        for name, args in _PRESET_ALIASES.items():
            option = optparse.Option('-t', help=shlex.join(args))
            formatter.option_strings[option] = f'-t {name}'
            result.append(formatter.format_option(option))
        formatter.dedent()
        formatter.dedent()
        help_lines = '\n'.join(result)
        return f'{formatted_help}\n{heading}{help_lines}'


def create_parser():
    def _list_from_options_callback(option, opt_str, value, parser, append=True, delim=',', process=str.strip):
        # append can be True, False or -1 (prepend)
        current = list(getattr(parser.values, option.dest)) if append else []
        value = list(filter(None, [process(value)] if delim is None else map(process, value.split(delim))))
        setattr(
            parser.values, option.dest,
            current + value if append is True else value + current)

    def _set_from_options_callback(
            option, opt_str, value, parser, allowed_values, delim=',', aliases={},
            process=lambda x: x.lower().strip()):
        values = [process(value)] if delim is None else map(process, value.split(delim))