<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def getSubOrder(existing):
 """ Alpha sort by the full chain of parents. """

    alpha = list(zip(*sorted(((k, v['rec']['label']) for k, v in existing.items()), key=lambda a: a[1])))[0]
    depths = {}
    def getDepth(id_):
        if id_ in depths:
            return depths[id_]
        else:
            if id_ in existing:
                names_above = getDepth(existing[id_]['sc'])
                depths[id_] = names_above + [existing[id_]['rec']['label']]
                return depths[id_]
            else:
                return ['']

    for id_ in existing:
        getDepth(id_)

    print(sorted(depths.values()))

    def key_(id_):
        return depths[id_]

    return sorted(depths, key=key_)