'Remove newlines from a string.'

def safe(self, string):

    if ((sys.version_info.major >= 3) and isinstance(string, bytes)):
        string = string.decode(u'utf8')
    elif (sys.version_info.major < 3):
        if (not isinstance(string, unicode)):
            string = unicode(string, encoding=u'utf8')
    string = string.replace(u'\n', u'')
    string = string.replace(u'\r', u'')
    return string
