<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def generic_html(self, result, errors):
 """ Try to display any object in sensible HTML. """

        h1 = htmlize(type(result))
        out = []
        result = pre_process_json(result)

        if not hasattr(result, 'items'):
            # result is a non-container
            header = "<tr><th>Value</th></tr>"
            if type(result) is list:
                result = htmlize_list(result)
            else:
                result = htmlize(result)
            out = ["<tr><td>" + result + "</td></tr>"]
        elif hasattr(result, 'lower'):
            out = ["<tr><td>" + result + "</td></tr>"]
        else:
            # object is a dict
            header = "<tr><th>Key</th><th>Value</th></tr>"
            for key, value in result.items():
                v = htmlize(value)
                row = "<tr><td>{0}</td><td>{1}</td></tr>".format(key, v)
                out.append(row)

        env = Environment(loader=PackageLoader('giotto'))
        template = env.get_template('generic.html')
        rendered = template.render({'header': h1, 'table_header': header, 'table_body': out})
        return {'body': rendered, 'mimetype': 'text/html'}