def update_response(d: ApiDefinition, m: Callable):
    if GeneratorUtils.response_is_list(d):
        return f'''
            if {request_id(d, m)} in self._req_state:
                req_state = {current_request_state(d, m)}
                if req_state.response is None:
                    req_state.response = []
                req_state.response.append({response_instance(d, m)})'''
    else:
        return f'''
            if {request_id(d, m)} in self._req_state:
                req_state = {current_request_state(d, m)}
                if req_state is not None:
                    req_state.response = {response_instance(d, m)}'''
def update_response(d: ApiDefinition, m: Callable):
    if GeneratorUtils.response_is_list(d):
        return f'
            if {request_id(d, m)} in self._req_state:
                req_state = {current_request_state(d, m)}
                if req_state.response is None:
                    req_state.response = []
                req_state.response.append({response_instance(d, m)})'
    else:
        return f'
            if {request_id(d, m)} in self._req_state:
                req_state = {current_request_state(d, m)}
                if req_state is not None:
                    req_state.response = {response_instance(d, m)}'