<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def insert_sort(node, target):
 """Insert node into sorted position in target tree. Uses sort function and language from target"""

    sort = target.sort
    lang = target.lang
    collator = Collator.createInstance(Locale(lang) if lang else Locale())
    for child in target.tree:
        if collator.compare(sort(child) or '', sort(node) or '') > 0:
            child.addprevious(node)
            break
    else:
        target.tree.append(node)