def _decode_label(label):
    """Convert a list label into a tuple. Works recursively on nested lists."""
    if isinstance(label, list):
        return tuple(_decode_label(v) for v in label)
    return label