'Returns a string from an address ad. It returns None if ad is not
defined as UNK, FUNC, CODE, *WORD, ... and if it\'s not a defined
symbol. If the mangling is activated it returns the demangled string.'

def get_symbol(self, ad):

    if (ad in self.__db.reverse_symbols):
        if self.__gctx.show_mangling:
            s = self.__db.reverse_demangled.get(ad, None)
            if (s is not None):
                return s
        return self.__db.reverse_symbols[ad]
    ty = self.mem.get_type(ad)
    if (ty == MEM_ARRAY):
        ty = self.mem.mm[ad][2]
    if (ty == MEM_FUNC):
        return ('sub_%x' % ad)
    if (ty == MEM_CODE):
        if (ad in self.__db.xrefs):
            return ('loc_%x' % ad)
        return None
    if (ty == MEM_DWORD):
        return ('dword_%x' % ad)
    if (ty == MEM_BYTE):
        return ('byte_%x' % ad)
    if (ty == MEM_QWORD):
        return ('qword_%x' % ad)
    if (ty == MEM_UNK):
        return ('unk_%x' % ad)
    if (ty == MEM_WORD):
        return ('word_%x' % ad)
    if (ty == MEM_ASCII):
        return ('asc_%x' % ad)
    if (MEM_WOFFSET <= ty <= MEM_QOFFSET):
        return ('off_%x' % ad)
    return None
