human
I wrote the below code

    def substitute_entity(match):
        try:
            ent = match.group(3)
            if (match.group(1) == '#'):
                if (match.group(2) == ''):
                    return safe_unichr(int(ent))
                elif (match.group(2) in ['x', 'X']):
                    return safe_unichr(int(ent, 16))
            else:
                cp = n2cp.get(ent)
                if cp:
                    return safe_unichr(cp)
                else:
                    return match.group()
        except:
            return match.group()
    return RE_HTML_ENTITY.sub(substitute_entity, text)

What's a good function header?

=====
Here's a good function header?
assistant
#Here's a good function header.

def decode_htmlentities(text):