from typing import List
from typing import Tuple


def reform_pattern(pattern_list: List) -> Tuple:
    """
    The updated pattern is a nested list which can not be used in pattern match. This function recursively
    converts a nested list to a nested tuple.

    Example:
        input pattern_list: [add, [conv, relu], conv]
        output: (add, (conv, relu), conv)

    Args:
        pattern_list: the pattern list requiring conversion.
    """
    if len(pattern_list) == 1:
        return tuple(pattern_list)
    else:
        for item in pattern_list:
            if isinstance(item, list):
                idx = pattern_list.index(item)
                pattern_list[idx] = reform_pattern(item)
            else:
                continue
        return tuple(pattern_list)