human
I wrote the below code

    clear_cache()
    apps = frappe.get_all_apps(True)
    messages = []
    untranslated = []
    for app in apps:
        messages.extend(get_messages_for_app(app))
    messages = deduplicate_messages(messages)
    def escape_newlines(s):
        return s.replace(u'\\\n', u'|||||').replace(u'\\n', u'||||').replace(u'\n', u'|||')
    if get_all:
        print((str(len(messages)) + u'    messages'))
        with open(untranslated_file, u'w') as f:
            for m in messages:
                f.write((escape_newlines(m[1]) + os.linesep).encode(u'utf-8'))
    else:
        full_dict = get_full_dict(lang)
        for m in messages:
            if (not full_dict.get(m[1])):
                untranslated.append(m[1])
        if untranslated:
            print(((str(len(untranslated)) + u'    missing    translations    of    ') + str(len(messages))))
            with open(untranslated_file, u'w') as f:
                for m in untranslated:
                    f.write((escape_newlines(m) + os.linesep).encode(u'utf-8'))
        else:
            print(u'all    translated!')

What's a good function header?
assistant
#Here's a good function header.

def get_untranslated(lang, untranslated_file, get_all=False):