'Ensure ID is unique. Append \'_1\', \'_2\'... if not'

def _unique_id(self, id):

    while (id in self.IDs):
        m = IDCOUNT_RE.match(id)
        if m:
            id = ('%s_%d' % (m.group(1), (int(m.group(2)) + 1)))
        else:
            id = ('%s_%d' % (id, 1))
    self.IDs.append(id)
    return id
