Write a function that consumes stream data and prints it in a given string format, using a fixed-size buffer so printing only happens once the buffer is full, repeating until the stream is exhausted.
Asked in the onsite stage. For grading, return the exact string that would be printed instead of writing to standard output.
Implement format_stream(stream, format_string, buffer_size). stream is a list of strings, format_string is a valid format string containing one {} placeholder, and buffer_size is a positive integer. Return one string containing every formatted item in input order. Flush a partial buffer once the stream is exhausted.
{} placeholderdef format_stream(stream, format_string, buffer_size):