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

Code before:
                filter(supports_terminal_sequences, (sys.stderr, sys.stdout)), None)
        )

        try:
            windows_enable_vt_mode()
        except Exception as e:
            self.write_debug(f'Failed to enable VT mode: {e}')

        color_policy = self.params.get('color') or {}
        self.params['color'] = {
            name: (
                'nocolor' if self.params.get('no_color') else
                color_policy if isinstance(color_policy, str) else
                color_policy.get(name) or 'auto')
            for name in ('screen', 'stdout', 'stderr')
        }
        term_allow_color = os.environ.get('TERM', '').lower() != 'dumb'

        def process_color_policy(name, stream):
            policy = self.params['color'].get(name)
            if policy == 'never':
                return False
            if policy == 'always':
                return True
            if policy == 'nocolor':
                return 'nocolor'
            return term_allow_color and supports_terminal_sequences(stream)

        self._allow_colors = Namespace(
            out=process_color_policy('stdout', self._out_files.out),
            error=process_color_policy('stderr', self._out_files.error),
            screen=process_color_policy('screen', self._out_files.screen),
        )

        # The code is left like this to be reused for future deprecations
        MIN_SUPPORTED, MIN_RECOMMENDED = (3, 7), (3, 7)
        current_version = sys.version_info[:2]
        if current_version < MIN_RECOMMENDED:
            msg = ('Support for Python version %d.%d has been deprecated. '
                   'See  https://github.com/yt-dlp/yt-dlp/issues/3764  for more details.'
                   '\n                    You will no longer receive updates on this version')
            if current_version < MIN_SUPPORTED:
                msg = 'Python version %d.%d is no longer supported'
            self.deprecated_feature(
                f'{msg}! Please update to Python %d.%d or above' % (*current_version, *MIN_RECOMMENDED))

        if self.params.get('allow_unplayable_formats'):
            self.report_warning(
                f'You have asked for {self._format_err("UNPLAYABLE", self.Styles.EMPHASIS)} formats to be listed/downloaded. '
                'This is a developer option intended for debugging. \n'
                '         If you experience any issues while using this option, '

Review comment (suggestion):
This translation should happen in `__init__.py` imo. API can just accept `True/False/None/'nocolor'`

Code after:
                filter(supports_terminal_sequences, (sys.stderr, sys.stdout)), None)
        )

        try:
            windows_enable_vt_mode()
        except Exception as e:
            self.write_debug(f'Failed to enable VT mode: {e}')

        if self.params.get('no_color'):
            if self.params.get('color') is not None:
                self.report_warning('Overwriting params from "color" with "no_color"')
            self.params['color'] = 'no_color'

        term_allow_color = os.environ.get('TERM', '').lower() != 'dumb'

        def process_color_policy(stream):
            stream_name = {sys.stdout: 'stdout', sys.stderr: 'stderr'}[stream]
            policy = traverse_obj(self.params, ('color', (stream_name, None), {str}), get_all=False)
            if policy in ('auto', None):
                return term_allow_color and supports_terminal_sequences(stream)
            assert policy in ('always', 'never', 'no_color')
            return {'always': True, 'never': False}.get(policy, policy)

        self._allow_colors = Namespace(**{
            name: process_color_policy(stream)
            for name, stream in self._out_files.items_ if name != 'console'
        })

        # The code is left like this to be reused for future deprecations
        MIN_SUPPORTED, MIN_RECOMMENDED = (3, 7), (3, 7)
        current_version = sys.version_info[:2]
        if current_version < MIN_RECOMMENDED:
            msg = ('Support for Python version %d.%d has been deprecated. '
                   'See  https://github.com/yt-dlp/yt-dlp/issues/3764  for more details.'
                   '\n                    You will no longer receive updates on this version')
            if current_version < MIN_SUPPORTED:
                msg = 'Python version %d.%d is no longer supported'
            self.deprecated_feature(
                f'{msg}! Please update to Python %d.%d or above' % (*current_version, *MIN_RECOMMENDED))

        if self.params.get('allow_unplayable_formats'):
            self.report_warning(
                f'You have asked for {self._format_err("UNPLAYABLE", self.Styles.EMPHASIS)} formats to be listed/downloaded. '
                'This is a developer option intended for debugging. \n'
                '         If you experience any issues while using this option, '
                f'{self._format_err("DO NOT", self.Styles.ERROR)} open a bug report')

        if self.params.get('bidi_workaround', False):
            try:
                import pty
                master, slave = pty.openpty()