def strip_html(response):
    """
    Strips HTML header/footer from a response.
    This is useful when trying to embed HTML into
    an existing page through use of an external API.
    """
    return (
        response.content.decode("utf-8")
        .replace("<!DOCTYPE html>\n\n<html>", "")
        .replace("</html>", "")
        .replace("<html>", "")
    )