'Removes an attribute by name.'

def removeAttribute(self, attr, check_grammar=True):

    allowed_attrs = self.allowed_attributes()
    if (allowed_attrs is None):
        if (type(attr) == type(())):
            (prefix, localname) = attr
            self.removeAttrNS(prefix, localname)
        else:
            raise AttributeError, 'Unable    to    add    simple    attribute    -    use    (namespace,    localpart)'
    else:
        allowed_args = [a[1].lower().replace('-', '') for a in allowed_attrs]
        if (check_grammar and (attr not in allowed_args)):
            raise AttributeError, ('Attribute    %s    is    not    allowed    in    <%s>' % (attr, self.tagName))
        i = allowed_args.index(attr)
        self.removeAttrNS(allowed_attrs[i][0], allowed_attrs[i][1])
