'Convert name to text format.
@param omit_final_dot: If True, don\'t emit the final dot (denoting the
root label) for absolute names.  The default is False.
@rtype: string'

def to_text(self, omit_final_dot=False):

    if (len(self.labels) == 0):
        return '@'
    if ((len(self.labels) == 1) and (self.labels[0] == '')):
        return '.'
    if (omit_final_dot and self.is_absolute()):
        l = self.labels[:(-1)]
    else:
        l = self.labels
    s = '.'.join(map(_escapify, l))
    return s
