code: def _resolve_entity (mo):
      
      ent = mo.group("entity")
      s = mo.group()
      if s.startswith('&#'):
          if s[2] in 'xX':
              radix = 16
          else:
              radix = 10
          try:
              num = int(ent, radix)
          except (ValueError, OverflowError):
              return u''
      else:
          num = name2codepoint.get(ent)
      if num is None or num < 0:
          # unknown entity -> ignore
          return u''
      try:
          return unichr(num)
      except ValueError:
          return u''
docs: Resolve a HTML entity.
  
      @param mo: matched _entity_re object with a "entity" match group
      @type mo: MatchObject instance
      @return: resolved entity char, or empty string on error
      @rtype: unicode string