def METHOD_NAME(item, identifier, stream):
    if not item:
        return
    if any(isinstance(el, dict) for el in item):
        all_keys = _all_scalar_keys(item)
        for element in item:
            _format_text(
                element, stream=stream, identifier=identifier, scalar_keys=all_keys
            )
    elif any(isinstance(el, list) for el in item):
        scalar_elements, non_scalars = _partition_list(item)
        if scalar_elements:
            _format_scalar_list(scalar_elements, identifier, stream)
        for non_scalar in non_scalars:
            _format_text(non_scalar, stream=stream, identifier=identifier)
    else:
        _format_scalar_list(item, identifier, stream)