def show_diff(before_editing: str, after_editing: str) -> None:
    """Show a diff between two strings.

    Inputs are expected to be unicode strings.

    If the output is to a tty the diff will be colored.

    .. note::
        If tty it requires a pager program, and uses first found among:
            * Program given by ``PAGER`` environment variable; or
            * ``less``; or
            * ``more``.

    :param before_editing: string to be compared with *after_editing*.
    :param after_editing: string to be compared with *before_editing*.

    :raises:
        :class:`PatroniCtlException`: if no suitable pager can be found when printing diff output to a tty.
    """
    def listify(string: str) -> List[str]:
        return [line + '\n' for line in string.rstrip('\n').split('\n')]

    unified_diff = difflib.unified_diff(listify(before_editing), listify(after_editing))

    if sys.stdout.isatty():
        buf = io.BytesIO()
        for line in unified_diff:
            buf.write(line.encode('utf-8'))
        buf.seek(0)

        class opts:
            theme = 'default'
            side_by_side = False
            width = 80
            tab_width = 8
            wrap = True
            pager = next(
                (
                    os.path.basename(p)
                    for p in (os.environ.get('PAGER'), "less", "more")
                    if p is not None and bool(shutil.which(p))
                ),
                None,
            )
            pager_options = None

        if opts.pager is None:
            raise PatroniCtlException(
                'No pager could be found. Either set PAGER environment variable with '
                'your pager or install either "less" or "more" in the host.'
            )

        # if we end up selecting "less" as "pager" then we set "pager" attribute
        # to "None". "less" is the default pager for "ydiff" module, and that
        # module adds some command-line options to "less" when "pager" is "None"
        if opts.pager == 'less':
            opts.pager = None

        markup_to_pager(PatchStream(buf), opts)
    else:
        for line in unified_diff:
            click.echo(line.rstrip('\n'))
Show a diff between two strings.

    Inputs are expected to be unicode strings.

    If the output is to a tty the diff will be colored.

    .. note::
        If tty it requires a pager program, and uses first found among:
            * Program given by ``PAGER`` environment variable; or
            * ``less``; or
            * ``more``.

    :param before_editing: string to be compared with *after_editing*.
    :param after_editing: string to be compared with *before_editing*.

    :raises:
        :class:`PatroniCtlException`: if no suitable pager can be found when printing diff output to a tty.
    
patroni/ctl.py