def to_data(x: Any) -> Any:
    if ('to_data' in dir(x)):
        return x.to_data()
    if isinstance(x, list):
        return [to_data(g) for g in x]
    if isinstance(x, dict):
        return dict_to_data(x)
    return x
def to_data(x: Any) -> Any:
    if ('to_data' in dir(x)):
        return x.to_data()
    if isinstance(x, list):
        return [to_data(g) for g in x]
    if isinstance(x, dict):
        return dict_to_data(x)
    return x