

def handle_entityref(self, name):
    entity = htmlentitydefs.entitydefs.get(name)
    if entity:
        if (len(entity) == 1):
            entity = ord(entity)
        else:
            entity = int(entity[2:(- 1)])
        if (0 <= entity < 128):
            self.__builder.data(chr(entity))
        else:
            self.__builder.data(unichr(entity))
    else:
        self.unknown_entityref(name)

dataset/ETHPy150Open CollabQ/CollabQ/vendor/elementtree/HTMLTreeBuilder.py HTMLTreeBuilder.handle_entityref/original