#NEWLINE# def get_dynamic_element( key , val ) : #NEWLINE# #INDENT# '\n    Gets an element from a key/value pair assumed to be pulled from\n    a case object (usually in the dynamic properties)\n    ' #NEWLINE# element = ElementTree . Element ( key ) #NEWLINE# if isinstance ( val , dict ) : #NEWLINE# #INDENT# element . text = unicode ( val . get ( '#text' , '' ) ) #NEWLINE# element . attrib = dict ( [ ( x [ 1 : ] , unicode ( val [ x ] ) ) for x in filter ( ( lambda x : ( x and x . startswith ( '@' ) ) ) , val . keys ( ) ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# element . text = unicode ( val ) #NEWLINE# #UNINDENT# return element