def export_to_html(<EOL>table, filename_or_fobj=None, encoding="<STR_LIT:utf-8>", caption=False, *args, **kwargs<EOL>):
serialized_table = serialize(table, *args, **kwargs)<EOL>fields = next(serialized_table)<EOL>result = ["<STR_LIT>"]<EOL>if caption and table.name:<EOL><INDENT>result.extend(["<STR_LIT>", table.name, "<STR_LIT>"])<EOL><DEDENT>result.extend(["<STR_LIT>", "<STR_LIT>"])<EOL>header = ["<STR_LIT>".format(field) for field in fields]<EOL>result.extend(header)<EOL>result.extend(["<STR_LIT>", "<STR_LIT>", "<STR_LIT:\n>", "<STR_LIT>", "<STR_LIT:\n>"])<EOL>for index, row in enumerate(serialized_table, start=<NUM_LIT:1>):<EOL><INDENT>css_class = "<STR_LIT>" if index % <NUM_LIT:2> == <NUM_LIT:1> else "<STR_LIT>"<EOL>result.append('<STR_LIT>'.format(css_class))<EOL>for value in row:<EOL><INDENT>result.extend(["<STR_LIT>", escape(value), "<STR_LIT>"])<EOL><DEDENT>result.append("<STR_LIT>")<EOL><DEDENT>result.append("<STR_LIT>")<EOL>html = "<STR_LIT>".join(result).encode(encoding)<EOL>return export_data(filename_or_fobj, html, mode="<STR_LIT:wb>")<EOL>
Export and return rows.Table data to HTML file.