'Compare attribute names `a1` and `a2`.  Used in
propagate_attributes to determine propagation order.
See built-in function `cmp` for return value.'

def attribute_cmp(self, a1, a2):

    if ((a1 in self.attribute_order) and (a2 in self.attribute_order)):
        return cmp(self.attribute_order.index(a1), self.attribute_order.index(a2))
    if ((a1 in self.attribute_order) != (a2 in self.attribute_order)):
        return (((a1 in self.attribute_order) and (-1)) or 1)
    else:
        return cmp(a1, a2)
