(id, ids)
return id
Ensure id is unique in set of ids. Append '_1', '_2'... if not
Ensure id is unique in set of ids. Append '_1', '_2'... if not
Ensure id is unique in set of ids . Append _1 _2 ... if not
def unique(id, ids):
    """ Ensure id is unique in set of ids. Append '_1', '_2'... if not """
    while id in ids or not id:
        m = IDCOUNT_RE.match(id)
        if m:
            id = '%s_%d'% (m.group(1), int(m.group(2))+1)
        else:
            id = '%s_%d'% (id, 1)
    ids.append(id)
    return id
def unique ( id , ids ) : while id in ids or not id : m = IDCOUNT_RE . match ( id ) if m : id = '%s_%d' % ( m . group ( 1 ) , int ( m . group ( 2 ) ) + 1 ) else : id = '%s_%d' % ( id , 1 ) ids . append ( id ) return id