def METHOD_NAME(val, attr_type, attr_name):
    if _is_openapi_list_type(attr_type):
        sub_kls = _get_openapi_list_element_type(attr_type)
        return [
            METHOD_NAME(list_value, sub_kls, f"{attr_name}[{index}]")
            for index, list_value in enumerate(val)
        ]
    elif _is_openapi_dict_type(attr_type):
        sub_kls = _get_openapi_dict_value_type(attr_type)
        return {k: METHOD_NAME(v, sub_kls, f"{attr_name}[{k}]") for k, v in val.items()}
    else:
        klass = _get_k8s_class(attr_type)
        if klass in ApiClient.PRIMITIVE_TYPES or klass in (
            object,
            datetime.date,
            datetime.datetime,
        ):
            return val
        else:
            if not isinstance(val, dict):
                raise Exception(
                    f"Attribute {attr_name} of type {klass.__name__} must be a dict, received"
                    f" {val} instead"
                )
            return k8s_snake_case_dict(klass, val)