def smart_translate_item_data(item_data):
 if isinstance(item_data, basestring):
  return _(item_data)
 elif isinstance(item_data, list):
  return map(smart_translate_item_data, item_data)
 elif isinstance(item_data, dict):
  if ('content' in item_data):
   item_data['content'] = (_(item_data['content']) if item_data['content'] else '')
  for (field, field_data) in item_data.iteritems():
   if isinstance(field_data, dict):
    item_data[field] = smart_translate_item_data(field_data)
   elif isinstance(field_data, list):
    item_data[field] = map(smart_translate_item_data, field_data)
  return item_data

def smart_translate_item_data ( item_data ) : if isinstance ( item_data , basestring ) : return _ ( item_data ) elif isinstance ( item_data , list ) : return map ( smart_translate_item_data , item_data ) elif isinstance ( item_data , dict ) : if ( 'content' in item_data ) : item_data [ 'content' ] = ( _ ( item_data [ 'content' ] ) if item_data [ 'content' ] else '' ) for ( field , field_data ) in item_data . iteritems ( ) : if isinstance ( field_data , dict ) : item_data [ field ] = smart_translate_item_data ( field_data ) elif isinstance ( field_data , list ) : item_data [ field ] = map ( smart_translate_item_data , field_data ) return item_data
auto translate the content fields of a given assessment item data .