r"""Make a string appear bold in LaTeX formatting.

    bold() wraps a given string in the LaTeX command \textbf{}.

    Args
    ----
    s : str
        The string to be formatted.
    escape: bool
        If true the bold text will be escaped

    Returns
    -------
    NoEscape
        The formatted string.

    Examples
    --------
    >>> bold("hello")
    '\\textbf{hello}'
    >>> print(bold("hello"))
    \textbf{hello}

def bold(s, *, escape=True):
    r"""Make a string appear bold in LaTeX formatting.

    bold() wraps a given string in the LaTeX command \textbf{}.

    Args
    ----
    s : str
        The string to be formatted.
    escape: bool
        If true the bold text will be escaped

    Returns
    -------
    NoEscape
        The formatted string.

    Examples
    --------
    >>> bold("hello")
    '\\textbf{hello}'
    >>> print(bold("hello"))
    \textbf{hello}
    """

    if escape:
        s = escape_latex(s)

    return NoEscape(r'\textbf{' + s + '}')