from typing import Union


def parse_to_list(input_elt: Union[str, list]) -> list:
    """
    Transforms an input string to a list

    :param list input_elt: The input element, either it is in str format or list format
    :return: a list
    """
    if isinstance(input_elt, str):
        input_elt = input_elt.replace("[", "")
        input_elt = input_elt.replace("]", "")
        input_elt = input_elt.replace("'", "")
        input_elt = input_elt.replace(" ", "")
        parsing_dict = {}
        for parsing_separator in [",", "\n"]:
            parsing_dict[len(list(input_elt.split(parsing_separator)))] = \
                list(input_elt.split(parsing_separator))
        return parsing_dict[max(parsing_dict.keys())]
    return input_elt