def METHOD_NAME(validation_errors: Union[dict, list], camelize=True):
    if isinstance(validation_errors, list):
        for i, item in enumerate(validation_errors):
            for err in METHOD_NAME(item):
                err["name"] = f"{i}.{err['name']}"
                yield err
    else:
        for field_name, error_list in validation_errors.items():
            new_name = underscore_to_camel(field_name) if camelize else field_name
            # nested validation for fields where many=True
            if isinstance(error_list, list):
                for i, nested_error_dict in enumerate(error_list):
                    if isinstance(nested_error_dict, dict):
                        for err in METHOD_NAME(
                            nested_error_dict, camelize=field_name != "data"
                        ):
                            err["name"] = f"{new_name}.{i}.{err['name']}"
                            yield err
            # nested validation - recursively call the function
            if isinstance(error_list, dict):
                for err in METHOD_NAME(
                    error_list, camelize=field_name != "data"
                ):
                    err["name"] = f"{new_name}.{err['name']}"
                    yield err
                continue
            if isinstance(error_list, exceptions.ErrorDetail):
                error_list = [error_list]
            for error in error_list:
                if isinstance(error, dict):
                    continue
                if isinstance(error, list):
                    for err in error:
                        yield OrderedDict(
                            [
                                # see https://tools.ietf.org/html/rfc7807#section-3.1
                                # ('type', 'about:blank'),
                                (
                                    "name",
                                    underscore_to_camel(field_name)
                                    if camelize
                                    else field_name,
                                ),
                                ("code", err.code),
                                ("reason", str(err)),
                            ]
                        )
                else:
                    yield OrderedDict(
                        [
                            # see https://tools.ietf.org/html/rfc7807#section-3.1
                            # ('type', 'about:blank'),
                            (
                                "name",
                                underscore_to_camel(field_name)
                                if camelize
                                else field_name,
                            ),
                            ("code", error.code),
                            ("reason", str(error)),
                        ]
                    )