>>> OldNorsePhonology.orthographic_u_umlaut("a")
        'ö'
        >>> OldNorsePhonology.orthographic_u_umlaut("e")
        'e'

        :param sound:
        :return:
500325
def orthographic_u_umlaut(sound: str) -> str:
        
        if sound in OldNorsePhonology.U_UMLAUT:
            return OldNorsePhonology.U_UMLAUT[sound]
        else:
            return sound
747568
def get_cv_pattern(self, word, pprint=False):
        
        subscripts = {
            1: '₁',
            2: '₂',
            3: '₃',
            4: '₄',
            5: '₅',
            6: '₆',
            7: '₇',
            8: '₈',
            9: '₉',
            0: '₀'
        }
        pattern = []
        c_count = 1
        v_count = 1
        count = 0
        for char in word:
            if char in self.akkadian['consonants']:
                cv = 'C'
            else:
                cv = 'V'
                # remove length:
                if char in self.akkadian['macron_vowels']:
                    char = self.akkadian['short_vowels'][self.akkadian['macron_vowels'].index(char)]
                elif char in self.akkadian['circumflex_vowels']:
                    char = self.akkadian['short_vowels'][self.akkadian['circumflex_vowels'].index(char)]
            if char not in [x[2] for x in pattern]:
                if cv == 'C':
                    count = c_count
                    c_count += 1
                elif cv == 'V':
                    count = v_count
                    v_count += 1
                pattern.append((cv, count, char))
            elif char in [x[2] for x in pattern]:
                pattern.append((cv, next(x[1] for x in pattern if x[2] == char), char))
        if pprint:
            output = ''
            for item in pattern:
                output += (item[0] + subscripts[item[1]])
            return output
        return pattern
897372
def to_unicode(self, s):
        

        # Fixme: This is total horseshit
        if isinstance(s, unicode):
            return s
        if isinstance(s, str):
            return unicode(s, errors='ignore')

        # Just return the original object
        return s
1185746
def safe_str(u, errors="replace"):
    
    s = u.encode(sys.stdout.encoding or "utf-8", errors)
    return s
940369
def set_prev_sonorus(self):
        
        prev = self.get_prev_letter()
        if not prev:
            return
        if not (self.is_consonant() and prev.is_consonant()):
            return
        if self.is_sonorus() and self.is_paired_consonant():
            if self._get_sound(False) != 'в':
                prev.set_sonorus(True)
            return
        if self.is_deaf():
            prev.set_sonorus(False)
            return
995952
def soundex(text: str, engine: str = "udom83") -> str:
    
    if engine == "lk82":
        _soundex = lk82
    elif engine == "metasound":
        _soundex = metasound
    else:  # default, use "udom83"
        _soundex = udom83

    return _soundex(text)
56563
def ub_to_str(string):
    
    if not isinstance(string, str):
        if six.PY2:
            return str(string)
        else:
            return string.decode()
    return string
1228881
def exception_to_unicode(e, traceback=False):
    
    message = '%s: %s' % (e.__class__.__name__, to_unicode(e))
    if traceback:
        from docido_sdk.toolbox import get_last_traceback
        traceback_only = get_last_traceback().split('\n')[:-2]
        message = '\n%s\n%s' % (to_unicode('\n'.join(traceback_only)), message)
    return message
472612
def unicode_compatible(cls):
    
    if PY3:
        cls.__str__ = cls.__unicode__
        cls.__bytes__ = lambda self: self.__str__().encode("utf-8")
    else:
        cls.__str__ = lambda self: self.__unicode__().encode("utf-8")

    return cls
799804
def str_or_unicode(text):
    
    encoding = sys.stdout.encoding
    if sys.version_info > (3, 0):
        return text.encode(encoding).decode(encoding)
    return text.encode(encoding)
1312095
def convert_unicode_character_to_ascii_repr(match_obj):
    
    match = match_obj.group(0)
    code_point = ord(match)

    hex_repr = hex(code_point)
    hex_code_point = hex_repr[2:]

    hex_value = hex_code_point.zfill(6).upper()

    return '<U+{}>'.format(hex_value)
307155
def to_unicode(str_or_unicode, precise=False):
    
    if not isinstance(str_or_unicode, six.text_type):
        encoding = quick_detect_encoding(str_or_unicode) if precise else 'utf-8'
        return six.text_type(str_or_unicode, encoding, 'replace')
    return str_or_unicode
328891
def _safe_unicode(o):
    
    def clean(s):
        return u''.join([c if c in ASCII_PRINTABLE else '?' for c in s])
    if USING_PYTHON2:
        try:
            return unicode(o)
        except:
            try:
                s = str(o)
                try:
                    return s.decode("utf-8")
                except:
                    return clean(s[:2048]) + u" [Raw error message: " + unicode(s.encode("hex"), 'utf-8') + u"]"
            except:
                return u"(Unable to decode Python exception message)"
    else:
        return str(o)
1015682
def safe_unicode(string):
    """"""
    if not PY3:
        uni = string.replace(u'\u2019', "'")
        return uni.encode('utf-8')
        
    return string
508646
def soundexCode(self, char):
        '''
        '''
        lang = get_language(char)
        try:
            if lang == "en_US":
                return _soundex_map["soundex_en"][charmap[lang].index(char)]
            else:
                return _soundex_map["soundex"][charmap[lang].index(char)]
        except:
            # Case of exception KeyError because we don't have soundex
            # mapping for the character
            pass

        return 0
477137
def ustr(text):
    
    if text is not None:
        if sys.version_info >= (3, 0):
            return str(text)
        else:
            return unicode(text)
    else:
        return text
1096437
def safe_unichr(codepoint):
    
    if is_py2_narrow_build():
        return ("\\U%08x" % codepoint).decode("unicode-escape")
    elif PY2:
        return unichr(codepoint)
    return chr(codepoint)