human
I wrote the below code

    def fn(tag):
        for (attr, val) in list(tag.attrs.items()):
            rule = allowed_attrs.get(attr)
            if rule:
                if callable(rule):
                    new_val = rule(val)
                    if (new_val is None):
                        del tag[attr]
                    else:
                        tag[attr] = new_val
                else:
                    pass
            else:
                del tag[attr]
    return fn

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

def attribute_rule(allowed_attrs):