def find_JSON_format_data_structure(string, name, found, not_found, cannot_parse_JSON):
 try:
  name_start = string.index(name)
 except ValueError:
  not_found(name, string)
 else:
  name_length = len(name)
  name_end = (name_start + name_length)
  (_, remaining) = re.Scanner([('\\s*=\\s*', (lambda scanner, token: None))]).scan(string[name_end:])
  try:
   (data, end_position) = JSONDecoder().raw_decode(remaining)
  except ValueError as value_error:
   cannot_parse_JSON(remaining)
  else:
   found(data)

def find_JSON_format_data_structure ( string , name , found , not_found , cannot_parse_JSON ) : try : name_start = string . index ( name ) except ValueError : not_found ( name , string ) else : name_length = len ( name ) name_end = ( name_start + name_length ) ( _ , remaining ) = re . Scanner ( [ ( '\\s*=\\s*' , ( lambda scanner , token : None ) ) ] ) . scan ( string [ name_end : ] ) try : ( data , end_position ) = JSONDecoder ( ) . raw_decode ( remaining ) except ValueError as value_error : cannot_parse_JSON ( remaining ) else : found ( data )
finds a named json-format data structure in the string .