<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def messages(path, thread, fmt, nocolor, timezones, utc, noprogress, resolve, directory):
 """ Conversion of Facebook chat history. """

    with colorize_output(nocolor):
        try:
            chat_history = _process_history(
                path=path, thread=thread, timezones=timezones,
                utc=utc, noprogress=noprogress, resolve=resolve)
        except ProcessingFailure:
            return
        if directory:
            set_all_color(enabled=False)
        write(fmt, chat_history, directory or sys.stdout)