(text)
return result
Converts each character in text to it's equivalent GSM-decoded
    character. If the character is anything other than ESCAPE_CHAR,
    then it's decoded with GSM_03_38_POR_BASIC.
      If a character is the ESCAPE_CHAR, then it is skipped and the
    next character is decoded with GSM_03_38_POR_EXTENSION.
Converts each character in text to it's equivalent GSM-decoded
    character. If the character is anything other than ESCAPE_CHAR,
    then it's decoded with GSM_03_38_POR_BASIC.
      If a character is the ESCAPE_CHAR, then it is skipped and the
    next character is decoded with GSM_03_38_POR_EXTENSION.
Converts each character in text to it s equivalent GSM - decoded character . If the character is anything other than ESCAPE_CHAR then it s decoded with GSM_03_38_POR_BASIC . If a character is the ESCAPE_CHAR then it is skipped and the next character is decoded with GSM_03_38_POR_EXTENSION .
def gsm_to_unicode(text):
    """
      Converts each character in text to it's equivalent GSM-decoded
    character. If the character is anything other than ESCAPE_CHAR,
    then it's decoded with GSM_03_38_POR_BASIC.
      If a character is the ESCAPE_CHAR, then it is skipped and the
    next character is decoded with GSM_03_38_POR_EXTENSION.
    """
    result = ""
    is_escape = False
    for char in text:
        gsm_char_code = ord(char)
        if gsm_char_code == ESCAPE_CHAR:
            is_escape = True
        elif is_escape:
            ext_char = GSM_03_38_POR_EXTENSION.get(gsm_char_code, "")
            if ext_char:
                result += ext_char
            else:
                result += " %s" % GSM_03_38_POR_BASIC.get(gsm_char_code, "")
            is_escape = False
        else:
            result += GSM_03_38_POR_BASIC.get(gsm_char_code, "")
    return result
def gsm_to_unicode ( text ) : result = "" is_escape = False for char in text : gsm_char_code = ord ( char ) if gsm_char_code == ESCAPE_CHAR : is_escape = True elif is_escape : ext_char = GSM_03_38_POR_EXTENSION . get ( gsm_char_code , "" ) if ext_char : result += ext_char else : result += " %s" % GSM_03_38_POR_BASIC . get ( gsm_char_code , "" ) is_escape = False else : result += GSM_03_38_POR_BASIC . get ( gsm_char_code , "" ) return result