human
I wrote the below code

    def entitydecode(match):
        entity = match.group(1)
        try:
            if entity.startswith('#x'):
                return unichr(int(entity[2:], 16))
            elif entity.startswith('#'):
                return unichr(int(entity[1:]))
            elif (entity in name2codepoint):
                return unichr(name2codepoint[entity])
            else:
                return match.group(0)
        except:
            return match.group(0)
    if (not isinstance(text, unicode)):
        text = text.decode(DEFAULT_ENCODING, errors=HTML_ENCODE)
    return CHAR_REF_PATT.sub(entitydecode, text)

What's a good function header?

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

def htmldecode(text, use_repr=False):