def html_format(string):
    """
    Returns an HTML-escaped version of the input string, suitable for
    insertion into a &lt;pre&gt; tag

    **Parameters:**

    * `string`: the string to be escaped

    **Returns:** an HTML-escaped version of the input string
    """
    for x, y in (('&', '&amp;'), ('<', '&lt;'), ('>', '&gt;'), ('\t',
        '    '), (' ', '&nbsp;')):
        string = string.replace(x, y)
    return string
