# Buggy code
def main():
    argument_spec = ec2_argument_spec()
    argument_spec.update(
        dict(
            filters=dict(default=dict(), type="dict"),
            peer_connection_ids=dict(default=None, type="list"),
        )
    )

    module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

    # Validate Requirements
    if not HAS_BOTO3:
        module.fail_json(msg="botocore and boto3 are required.")

    try:
        region, ec2_url, aws_connect_kwargs = get_aws_connection_info(
            module, boto3=True
        )
    except NameError as e:
        # Getting around the get_aws_connection_info boto reliance for region
        if "global name 'boto' is not defined" in e.message:
            module.params["region"] = (
                botocore.session.get_session().get_config_variable("region")
            )
            if not module.params["region"]:
                module.fail_json(msg="Error - no region provided")
        else:
            module.fail_json(msg="Can't retrieve connection information - " + str(e))

    try:
        region, ec2_url, aws_connect_kwargs = get_aws_connection_info(
            module, boto3=True
        )
        ec2 = boto3_conn(
            module,
            conn_type="client",
            resource="ec2",
            region=region,
            endpoint=ec2_url,
            **aws_connect_kwargs,
        )
    except botocore.exceptions.NoCredentialsError as e:
        module.fail_json(msg=str(e))

    results = [camel_dict_to_snake_dict(peer) for peer in get_vpc_peers(ec2, module)]

    module.exit_json(result=results)


# Traceback (ParamValidationError)
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Invalid type for parameter Filters[1].Values[0], value: None, type: <type 'NoneType'>, valid types: <type 'basestring'>
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_8K4qEm/ansible_module_ec2_vpc_peer.py\", line 398, in <module>\n    main()\n  File \"/tmp/ansible_8K4qEm/ansible_module_ec2_vpc_peer.py\", line 388, in main\n    (changed, results) = create_peer_connection(client, module)\n  File \"/tmp/ansible_8K4qEm/ansible_module_ec2_vpc_peer.py\", line 262, in create_peer_connection\n    peering_conns = describe_peering_connections(params, client)\n  File \"/tmp/ansible_8K4qEm/ansible_module_ec2_vpc_peer.py\", line 233, in describe_peering_connections\n    {'Name': 'accepter-vpc-info.vpc-id', 'Values': [params['PeerVpcId']]}\n  File \"/usr/lib/python2.6/site-packages/botocore/client.py\", line 314, in _api_call\n    return self._make_api_call(operation_name, kwargs)\n  File \"/usr/lib/python2.6/site-packages/botocore/client.py\", line 586, in _make_api_call\n    api_params, operation_model, context=request_context)\n  File \"/usr/lib/python2.6/site-packages/botocore/client.py\", line 621, in _convert_to_request_dict\n    api_params, operation_model)\n  File \"/usr/lib/python2.6/site-packages/botocore/validate.py\", line 291, in serialize_to_request\n    raise ParamValidationError(report=report.generate_report())\nbotocore.exceptions.ParamValidationError: Parameter validation failed:\nInvalid type for parameter Filters[0].Values[0], value: None, type: <type 'NoneType'>, valid types: <type 'basestring'>\nInvalid type for parameter Filters[1].Values[0], value: None, type: <type 'NoneType'>, valid types: <type 'basestring'>\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}

# Fixed code
def main():
    argument_spec = ec2_argument_spec()
    argument_spec.update(
        dict(
            filters=dict(default=dict(), type="dict"),
            peer_connection_ids=dict(default=None, type="list"),
        )
    )

    module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)

    # Validate Requirements
    if not HAS_BOTO3:
        module.fail_json(msg="botocore and boto3 are required.")

    try:
        region, ec2_url, aws_connect_kwargs = get_aws_connection_info(
            module, boto3=True
        )
    except NameError as e:
        # Getting around the get_aws_connection_info boto reliance for region
        if "global name 'boto' is not defined" in e.message:
            module.params["region"] = (
                botocore.session.get_session().get_config_variable("region")
            )
            if not module.params["region"]:
                module.fail_json(msg="Error - no region provided")
        else:
            module.fail_json(msg="Can't retrieve connection information - " + str(e))

    try:
        region, ec2_url, aws_connect_kwargs = get_aws_connection_info(
            module, boto3=True
        )
        ec2 = boto3_conn(
            module,
            conn_type="client",
            resource="ec2",
            region=region,
            endpoint=ec2_url,
            **aws_connect_kwargs,
        )
    except botocore.exceptions.NoCredentialsError as e:
        module.fail_json(msg=str(e))

    # Turn the boto3 result in to ansible friendly_snaked_names
    results = [camel_dict_to_snake_dict(peer) for peer in get_vpc_peers(ec2, module)]

    # Turn the boto3 result in to ansible friendly tag dictionary
    for peer in results:
        peer["tags"] = boto3_tag_list_to_ansible_dict(peer.get("tags", []))

    module.exit_json(result=results)