def build_empty_response(search_path, operation_name, service_model):
 response = None
 operation_model = service_model.operation_model(operation_name)
 shape = operation_model.output_shape
 if search_path:
  for item in search_path.split('.'):
   item = item.strip('[0123456789]$')
   if (shape.type_name == 'structure'):
    shape = shape.members[item]
   elif (shape.type_name == 'list'):
    shape = shape.member
   else:
    raise NotImplementedError('Search path hits shape type {0} from {1}'.format(shape.type_name, item))
 if (shape.type_name == 'structure'):
  response = {}
 elif (shape.type_name == 'list'):
  response = []
 elif (shape.type_name == 'map'):
  response = {}
 return response

def build_empty_response ( search_path , operation_name , service_model ) : response = None operation_model = service_model . operation_model ( operation_name ) shape = operation_model . output_shape if search_path : for item in search_path . split ( '.' ) : item = item . strip ( '[0123456789]$' ) if ( shape . type_name == 'structure' ) : shape = shape . members [ item ] elif ( shape . type_name == 'list' ) : shape = shape . member else : raise NotImplementedError ( 'Search path hits shape type {0} from {1}' . format ( shape . type_name , item ) ) if ( shape . type_name == 'structure' ) : response = { } elif ( shape . type_name == 'list' ) : response = [ ] elif ( shape . type_name == 'map' ) : response = { } return response
creates an appropriate empty response for the type that is expected .