'Create HTML table, used for displaying peek'

def display_peek(self, dataset):

    out = ['<table    cellspacing="0"    cellpadding="3">']
    try:
        if (not dataset.peek):
            dataset.set_peek()
        data = dataset.peek
        lines = data.splitlines()
        for line in lines:
            line = line.strip()
            if (not line):
                continue
            out.append(('<tr><td>%s</td></tr>' % escape(unicodify(line, 'utf-8'))))
        out.append('</table>')
        out = ''.join(out)
    except Exception as exc:
        out = ("Can't    create    peek    %s" % str(exc))
    return out
