# Buggy code
def main():
    # use the predefined argument spec for url
    argument_spec = url_argument_spec()
    # remove unnecessary arguments
    del argument_spec["force"]
    del argument_spec["force_basic_auth"]
    del argument_spec["http_agent"]
    argument_spec.update(
        state=dict(choices=["present", "absent", "export"], default="present"),
        url=dict(aliases=["grafana_url"], required=True),
        url_username=dict(aliases=["grafana_user"], default="admin"),
        url_password=dict(aliases=["grafana_password"], default="admin", no_log=True),
        grafana_api_key=dict(type="str", no_log=True),
        org_id=dict(default=1, type="int"),
        folder=dict(type="str", default="General"),
        uid=dict(type="str"),
        slug=dict(type="str"),
        path=dict(type="str"),
        overwrite=dict(type="bool", default=False),
        message=dict(type="str"),
    )
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=False,
        required_together=[["url_username", "url_password", "org_id"]],
        mutually_exclusive=[["grafana_user", "grafana_api_key"], ["uid", "slug"]],
    )

    try:
        if module.params["state"] == "present":
            result = grafana_create_dashboard(module, module.params)
        elif module.params["state"] == "absent":
            result = grafana_delete_dashboard(module, module.params)
        else:
            result = grafana_export_dashboard(module, module.params)
    except GrafanaAPIException as e:
        module.fail_json(failed=True, msg="error : %s" % to_native(e))
        return
    except GrafanaMalformedJson as e:
        module.fail_json(failed=True, msg="error : %s" % to_native(e))
        return
    except GrafanaDeleteException as e:
        module.fail_json(
            failed=True, msg="error : Can't delete dashboard : %s" % to_native(e)
        )
        return
    except GrafanaExportException as e:
        module.fail_json(
            failed=True, msg="error : Can't export dashboard : %s" % to_native(e)
        )
        return

    module.exit_json(failed=False, **result)
    return


# Traceback (TypeError)
The full traceback is:
Traceback (most recent call last):
File "/home/kevin/.ansible/tmp/ansible-tmp-1536342721.9100335-54055516095596/AnsiballZ_datadog_monitor.py", line 113, in <module>
_ansiballz_main()
File "/home/kevin/.ansible/tmp/ansible-tmp-1536342721.9100335-54055516095596/AnsiballZ_datadog_monitor.py", line 105, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/kevin/.ansible/tmp/ansible-tmp-1536342721.9100335-54055516095596/AnsiballZ_datadog_monitor.py", line 48, in invoke_module
imp.load_module('__main__', mod, module, MOD_DESC)
File "/usr/lib64/python3.6/imp.py", line 235, in load_module
return load_source(name, filename, file)
File "/usr/lib64/python3.6/imp.py", line 170, in load_source
module = _exec(spec, sys.modules[name])
File "<frozen importlib._bootstrap>", line 618, in _exec
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/tmp/ansible_datadog_monitor_payload_2zuzk2lj/__main__.py", line 343, in <module>
File "/tmp/ansible_datadog_monitor_payload_2zuzk2lj/__main__.py", line 179, in main
File "/tmp/ansible_datadog_monitor_payload_2zuzk2lj/ansible_datadog_monitor_payload.zip/ansible/module_utils/basic.py", line 900, in __init__
File "/tmp/ansible_datadog_monitor_payload_2zuzk2lj/ansible_datadog_monitor_payload.zip/ansible/module_utils/basic.py", line 2242, in _log_invocation
File "/tmp/ansible_datadog_monitor_payload_2zuzk2lj/ansible_datadog_monitor_payload.zip/ansible/module_utils/basic.py", line 2200, in log
TypeError: send() got multiple values for keyword argument 'MESSAGE'

# Fixed code
def main():
    # use the predefined argument spec for url
    argument_spec = url_argument_spec()
    # remove unnecessary arguments
    del argument_spec["force"]
    del argument_spec["force_basic_auth"]
    del argument_spec["http_agent"]
    argument_spec.update(
        state=dict(choices=["present", "absent", "export"], default="present"),
        url=dict(aliases=["grafana_url"], required=True),
        url_username=dict(aliases=["grafana_user"], default="admin"),
        url_password=dict(aliases=["grafana_password"], default="admin", no_log=True),
        grafana_api_key=dict(type="str", no_log=True),
        org_id=dict(default=1, type="int"),
        folder=dict(type="str", default="General"),
        uid=dict(type="str"),
        slug=dict(type="str"),
        path=dict(type="str"),
        overwrite=dict(type="bool", default=False),
        commit_message=dict(
            type="str",
            aliases=["message"],
            deprecated_aliases=[dict(name="message", version="2.14")],
        ),
    )
    module = AnsibleModule(
        argument_spec=argument_spec,
        supports_check_mode=False,
        required_together=[["url_username", "url_password", "org_id"]],
        mutually_exclusive=[["grafana_user", "grafana_api_key"], ["uid", "slug"]],
    )

    if "message" in module.params:
        module.fail_json(
            msg="'message' is reserved keyword, please change this parameter to 'commit_message'"
        )

    try:
        if module.params["state"] == "present":
            result = grafana_create_dashboard(module, module.params)
        elif module.params["state"] == "absent":
            result = grafana_delete_dashboard(module, module.params)
        else:
            result = grafana_export_dashboard(module, module.params)
    except GrafanaAPIException as e:
        module.fail_json(failed=True, msg="error : %s" % to_native(e))
        return
    except GrafanaMalformedJson as e:
        module.fail_json(failed=True, msg="error : %s" % to_native(e))
        return
    except GrafanaDeleteException as e:
        module.fail_json(
            failed=True, msg="error : Can't delete dashboard : %s" % to_native(e)
        )
        return
    except GrafanaExportException as e:
        module.fail_json(
            failed=True, msg="error : Can't export dashboard : %s" % to_native(e)
        )
        return

    module.exit_json(failed=False, **result)
    return