Given a list of words, write a function such that it takes a character-by-character stream and return words from the provided list as they are found in the stream. The function should return either null or '' if the call cannot produce a word yet. When a word can be made, the characters should be removed from the stream and the word should be returned.
The function receives a mutable character buffer and one new character per call. Treat the buffer as an unordered collection of available characters, and check words in the provided order.
def produce_word(words, buffer, char):