def attribute_hash(attribute):
    """
    Given an attribute object, generate a hashable value
    that can be used for comparison
    """
    uid = ""

    # When we iterate over attribute properties use sorted
    # to get a consistent ordering
    for property_name in sorted(attribute.keys()):
        property_value = attribute[property_name]
        if property_name == "attributes" and property_value is not None:
            # These are sub-attributes
            # Add each to the string
            for a in property_value:
                uid += attribute_hash(a)
        else:
            uid += f"{property_name}={str(property_value)}&"

    return uid