def escape_html(s):
    """Escapes a string so it is valid within HTML. Converts `None`
    to an empty string. Raises TypeError is `s` is not a string
    or unicode object.

    >>> html_escape(None)
    ''

    >>> escape_html('&<>"\\'')
    "&amp;&lt;&gt;&quot;\'"
    """
    if s is None:
        return ""
    try:
        return (
            s.replace("&", "&amp;")
            .replace("<", "&lt;")
            .replace(">", "&gt;")
            .replace('"', "&quot;")
        )
    except AttributeError:
        raise TypeError(
            "expected string or unicode object, "
            "%s found" % s.__class__.__name__
        )