#NEWLINE# def flatten_result( result ) : #NEWLINE# #INDENT# "Flattens a result from CaseSearchES into the format that Case serializers\n    expect\n\n    i.e. instead of {'name': 'blah', 'case_properties':{'key':'foo', 'value':'bar'}} we return\n    {'name': 'blah', 'foo':'bar'}\n    " #NEWLINE# case_properties = result . pop ( 'case_properties' , None ) #NEWLINE# for case_property in case_properties : #NEWLINE# #INDENT# key = case_property . get ( 'key' ) #NEWLINE# value = case_property . get ( 'value' ) #NEWLINE# if ( key and value ) : #NEWLINE# #INDENT# result [ key ] = value #NEWLINE# #UNINDENT# #UNINDENT# return result