def otu_iter_nexson_proxy(nexson_proxy, otu_sort=None):
    """otu_sort can be None (not sorted or stable), True (sorted by ID lexigraphically)
    or a key function for a sort function on list of otuIDs

    Note that if there are multiple OTU groups, the NexSON specifies the order of sorting
        of the groups (so the sort argument here only refers to the sorting of OTUs within
        a group)
    """
    nexml_el = nexson_proxy._nexml_el
    og_order = nexml_el['^ot:otusElementOrder']
    ogd = nexml_el['otusById']
    for og_id in og_order:
        og = ogd[og_id]
        if otu_sort is None:
            for k, v in og:
                yield nexson_proxy._create_otu_proxy(k, v)
        else:
            key_list = list(og.keys())
            if otu_sort is True:
                key_list.sort()
            else:
                key_list.sort(key=otu_sort)
            for k in key_list:
                v = og[k]
                yield nexson_proxy._create_otu_proxy(k, v)