def lambda_handler(event, context):

    # Set event data from the API Gateway to variables.
    execution_mode = event['execution_mode']
    source_ip = event['source_ip']
    query_string = event['query_string']
    validation_hash = event['validation_hash']
    set_hostname = event['set_hostname']

    # Verify that the execution mode was set correctly.
    execution_modes = ('set', 'get')
    if execution_modes not in execution_mode:
        return_status = 'fail'
        return_message = 'You must pass mode=get or mode=set arguments.'
        return_dict = {'return_status': return_status,
                       'return_message': return_message}

    # For get mode, reflect the client's public IP address and exit.
    if execution_mode == 'get':
        return_status = 'success'
        return_message = source_ip
        return_dict = {'return_status': return_status,
                       'return_message': return_message}

    # Proceed with set mode to create or update the DNS record.
    else:
        return_dict = run_set_mode(set_hostname, validation_hash, source_ip)

    # This Lambda function always exits as a success
    # and passes success or failure information in the json message.
    return return_dict
dataset/ETHPy150Open awslabs/route53-dynamic-dns-with-lambda/dynamic_dns_lambda.py/lambda_handler/swapped operands of `not in`