#NEWLINE# def get_value( doc , key ) : #NEWLINE# #INDENT# if ( ( not key ) or ( not isinstance ( doc , dict ) ) ) : #NEWLINE# #INDENT# raise ValueError ( ) #NEWLINE# #UNINDENT# jsonpath_expr = parse ( key ) #NEWLINE# matches = jsonpath_expr . find ( doc ) #NEWLINE# value = ( None if ( len ( matches ) < 1 ) else matches [ 0 ] . value ) #NEWLINE# return value