'get_valid_attributes
get the current tag, and return the attributes that are allowed in that
element'

def get_valid_attributes(self, buf, pos):

    node = buf.xml_node_at_pos(pos)
    if (node is None):
        return None
    already_supplied = node.attrib.keys()
    handlerclass = buf.xml_tree_handler(node)
    attrs = handlerclass.attrs(buf.xml_tree, node)
    if (not attrs):
        return None
    attrs = [name for name in attrs if (name not in already_supplied)]
    attrs.sort()
    return attrs
