def METHOD_NAME(value: Any,
                        result: Dict[str, Any],
                        parent_name: Optional[str],
                        concat: bool) -> Any:
    if isinstance(value, datetime.datetime):
        return datetime.datetime.isoformat(value)
    elif isinstance(value, datetime.date):
        return datetime.date.isoformat(value)
    elif isinstance(value, PRIMITIVE_TYPES):
        return value
    try:
        items = value.items()
    except AttributeError:
        items = None
    if items:
        for k, v in items:
            if not isinstance(k, str):
                raise ValueError('all keys must be strings')
            v = METHOD_NAME(v, result, k, False)
            if v is not result:
                name = k if parent_name is None else parent_name + '_' + k
                if concat and name in result:
                    result[name] = f'{result[name]}, {v}'
                else:
                    result[name] = v
    for e in value:
        METHOD_NAME(e, result, parent_name, True)
    return result