def ret(meta_tree, field_name, *key_trail): for count, key in enumerate(key_trail, start=1): lbl = get_label_from_key(key) if lbl == label: target_key_trail = key_trail[:count] return index(meta_tree, field_name, *target_key_trail) return listify(None)
def ret(meta_tree, *key_trail): if key_trail[-1:]: label = labels.get_label_from_key(key_trail[-1]) return label == target_label else: return False