def handler(x): """ Callback to convert entity to UC """ v = x.group(1) if v.startswith('#'): try: return unichr(int(v[1:])) except ValueError: pass return entitydefs.get(v, '')
def handler(x): """ Callback to convert entity to UC """ v = x.group(1) return entitydefs.get(v, '')