def tuplize_dict(data_dict):
 tuplized_dict = {}
 for (key, value) in data_dict.iteritems():
  key_list = key.split('__')
  for (num, key) in enumerate(key_list):
   if ((num % 2) == 1):
    try:
     key_list[num] = int(key)
    except ValueError:
     raise df.DataError('Bad key')
  tuplized_dict[tuple(key_list)] = value
 return tuplized_dict

def tuplize_dict ( data_dict ) : tuplized_dict = { } for ( key , value ) in data_dict . iteritems ( ) : key_list = key . split ( '__' ) for ( num , key ) in enumerate ( key_list ) : if ( ( num % 2 ) == 1 ) : try : key_list [ num ] = int ( key ) except ValueError : raise df . DataError ( 'Bad key' ) tuplized_dict [ tuple ( key_list ) ] = value return tuplized_dict
takes a dict with keys of the form table__0__key and converts them to a tuple like .