'Emit a mIRC control sequence that will set up all the attributes this
formatting state has set.
@return: A string containing mIRC control sequences that mimic this
formatting state.'

def toMIRCControlCodes(self):

    attrs = []
    if self.bold:
        attrs.append(_BOLD)
    if self.underline:
        attrs.append(_UNDERLINE)
    if self.reverseVideo:
        attrs.append(_REVERSE_VIDEO)
    if ((self.foreground is not None) or (self.background is not None)):
        c = ''
        if (self.foreground is not None):
            c += ('%02d' % (self.foreground,))
        if (self.background is not None):
            c += (',%02d' % (self.background,))
        attrs.append((_COLOR + c))
    return (_OFF + ''.join(map(str, attrs)))
