def match_attributes(ref_attrs, test_attrs):
    """
    Returns IoU of the attributes. if No attributes returns 0
    0: no matching
    1: perfect attributes match
    """
    intersection = set(ref_attrs).intersection(set(test_attrs))
    union = set(ref_attrs).union(test_attrs)
    if len(union) == 0:
        return 1
    return len(intersection) / len(union)