Can you write a function to parse incoming messages and extract relevant data? Implement parse_messages(messages), where messages is a list of strings and each string contains whitespace-separated key=value fields. Return one dictionary per message, use the last value for duplicate keys, preserve quoted values with spaces, and ignore standalone separators or malformed tokens. If a message has invalid quoting, return an empty dictionary for that message.
def parse_messages(messages):