Init depth2goobjs using list sorted by depth, get level-00/01 GO terms.

def get_depth2goobjs(go2obj, max_depth=2):
        """Init depth2goobjs using list sorted by depth, get level-00/01 GO terms."""
        depth2goobjs = {d:list() for d in range(max_depth+1)}
        goid_seen = set()
        for _, goobj in sorted(go2obj.items(), key=lambda t: t[1].depth):
            # Save depth-00, depth-01, depth-02
            if goobj.depth > max_depth:
                break
            goid = goobj.id
            if not goobj.is_obsolete and goid not in goid_seen:
                depth2goobjs[goobj.depth].append(goobj)
                goid_seen.add(goid)
        return depth2goobjs