from typing import Union


def format_docstr(doc: Union[str, None]) -> str:
    """Format a docstring.

    Args:
        doc (Union[str, None]): String to format

    Returns:
        str: Formatted string
    """

    if doc is None:
        return ''
    doc = doc.strip()
    text = f"""
<pre style="background-color: #EBECE4;">
<code class="DocString">{doc}</code>
</pre>
    """
    return text