def assign_textbook_id(textbook, used_ids=()):
 tid = Location.clean(textbook['tab_title'])
 if (not tid[0].isdigit()):
  tid = (random.choice(string.digits) + tid)
 while (tid in used_ids):
  tid = (tid + random.choice(string.ascii_lowercase))
 return tid

def assign_textbook_id ( textbook , used_ids = ( ) ) : tid = Location . clean ( textbook [ 'tab_title' ] ) if ( not tid [ 0 ] . isdigit ( ) ) : tid = ( random . choice ( string . digits ) + tid ) while ( tid in used_ids ) : tid = ( tid + random . choice ( string . ascii_lowercase ) ) return tid
return an id that can be assigned to a textbook and doesnt match the used_ids .