def entityref(self, c):
    if ((not self.unicode_snob) and (c in unifiable.keys())):
        return unifiable[c]
    else:
        try:
            name2cp(c)
        except KeyError:
            return (('&' + c) + ';')
        else:
            try:
                return unichr(name2cp(c))
            except NameError:
                return chr(name2cp(c))
def entityref(self, c):
    if ((not self.unicode_snob) and (c in unifiable.keys())):
        return unifiable[c]
    else:
        try:
            name2cp(c)
        except KeyError:
            return (('&' + c) + ';')
        else:
            try:
                return unichr(name2cp(c))
            except NameError:
                return chr(name2cp(c))