Render a string as Markdown only if in an IPython interpreter.

def maybe_render_markdown(string: str) -> Any:
    """Render a string as Markdown only if in an IPython interpreter."""
    if is_ipython_interpreter():  # pragma: no cover
        from IPython.display import Markdown  # type: ignore # noqa: E501

        return Markdown(string)
    else:
        return string