'Highlight a segment.'

def hl(self, contents, fg=None, bg=None, attrs=None):

    awesome_attr = []
    if (fg is not None):
        if ((fg is not False) and (fg[1] is not False)):
            awesome_attr += [u'foreground="#{0:06x}"'.format(fg[1])]
    if (bg is not None):
        if ((bg is not False) and (bg[1] is not False)):
            awesome_attr += [u'background="#{0:06x}"'.format(bg[1])]
    if ((attrs is not None) and (attrs is not False)):
        if (attrs & ATTR_BOLD):
            awesome_attr += [u'font_weight="bold"']
        if (attrs & ATTR_ITALIC):
            awesome_attr += [u'font_style="italic"']
        if (attrs & ATTR_UNDERLINE):
            awesome_attr += [u'underline="single"']
    return ((((u'<span    ' + u'    '.join(awesome_attr)) + u'>') + contents) + u'</span>')
