def send_cf_response(event, context, response_status, reason=None,<EOL>response_data=None, physical_resource_id=None):
response_data = response_data or {}<EOL>reason = reason or "<STR_LIT>" +context.log_stream_name<EOL>physical_resource_id = physical_resource_id or context.log_stream_name<EOL>response_body = json.dumps(<EOL>{<EOL>'<STR_LIT>': response_status,<EOL>'<STR_LIT>': reason,<EOL>'<STR_LIT>': physical_resource_id,<EOL>'<STR_LIT>': event['<STR_LIT>'],<EOL>'<STR_LIT>': event['<STR_LIT>'],<EOL>'<STR_LIT>': event['<STR_LIT>'],<EOL>'<STR_LIT>': response_data<EOL>}<EOL>)<EOL>opener = build_opener(HTTPHandler)<EOL>request = Request(event["<STR_LIT>"], data=response_body)<EOL>request.add_header("<STR_LIT:Content-Type>", "<STR_LIT>")<EOL>request.add_header("<STR_LIT>", len(response_body))<EOL>request.get_method = lambda: '<STR_LIT>'<EOL>try:<EOL><INDENT>response = opener.open(request)<EOL>print("<STR_LIT>".format(response.getcode()))<EOL>print("<STR_LIT>".format(response.msg))<EOL>return True<EOL><DEDENT>except HTTPError as exc:<EOL><INDENT>print("<STR_LIT>".format(exc.code))<EOL>return False<EOL><DEDENT>
Responds to Cloudformation after a create/update/delete operation.