this could be simplified to:

    for dirname in sets_ids.iterkeys():