def flatten_choices_dict(choices):
 ret = OrderedDict()
 for (key, value) in choices.items():
  if isinstance(value, dict):
   for (sub_key, sub_value) in value.items():
    ret[sub_key] = sub_value
  else:
   ret[key] = value
 return ret

def flatten_choices_dict ( choices ) : ret = OrderedDict ( ) for ( key , value ) in choices . items ( ) : if isinstance ( value , dict ) : for ( sub_key , sub_value ) in value . items ( ) : ret [ sub_key ] = sub_value else : ret [ key ] = value return ret
convert a group choices dict into a flat dict of choices .