# Buggy code
def __init__(self, module):
    self.module = module
    self.state = module.params["state"]
    self.autoconnect = module.params["autoconnect"]
    self.conn_name = module.params["conn_name"]
    self.master = module.params["master"]
    self.ifname = module.params["ifname"]
    self.type = module.params["type"]
    self.ip4 = module.params["ip4"]
    self.gw4 = module.params["gw4"]
    self.dns4 = " ".join(module.params["dns4"]) if module.params.get("dns4") else None
    self.dns4_search = (
        " ".join(module.params["dns4_search"])
        if module.params.get("dns4_search")
        else None
    )
    self.ip6 = module.params["ip6"]
    self.gw6 = module.params["gw6"]
    self.dns6 = module.params["dns6"]
    self.dns6_search = (
        " ".join(module.params["dns6_search"])
        if module.params.get("dns6_search")
        else None
    )
    self.mtu = module.params["mtu"]
    self.stp = module.params["stp"]
    self.priority = module.params["priority"]
    self.mode = module.params["mode"]
    self.miimon = module.params["miimon"]
    self.primary = module.params["primary"]
    self.downdelay = module.params["downdelay"]
    self.updelay = module.params["updelay"]
    self.arp_interval = module.params["arp_interval"]
    self.arp_ip_target = module.params["arp_ip_target"]
    self.slavepriority = module.params["slavepriority"]
    self.forwarddelay = module.params["forwarddelay"]
    self.hellotime = module.params["hellotime"]
    self.maxage = module.params["maxage"]
    self.ageingtime = module.params["ageingtime"]
    self.mac = module.params["mac"]
    self.vlanid = module.params["vlanid"]
    self.vlandev = module.params["vlandev"]
    self.flags = module.params["flags"]
    self.ingress = module.params["ingress"]
    self.egress = module.params["egress"]
    self.nmcli_bin = self.module.get_bin_path("nmcli", True)


# Traceback (nTypeError)
failed: [sqlmaster1] (item={u'ip4': u'10.0.3.27/24', u'dev': u'ens224'}) => {"changed": false, "failed": true, "item": {"dev": "ens224", "ip4": "10.0.3.27/24"}, "module_stderr": "BECOME-SUCCESS-geacueqlzcdnmgrvmmrmkvmraxfijkly\r\n", "module_stdout": "/tmp/ansible_PpATO0/ansible_module_nmcli.py:493: PyGIWarning: NetworkManager was imported without specifying a version first. Use gi.require_version('NetworkManager', '1.0') before import to ensure that the right version gets loaded.\r\n  from gi.repository import NetworkManager, NMClient\r\n/tmp/ansible_PpATO0/ansible_module_nmcli.py:493: PyGIWarning: NMClient was imported without specifying a version first. Use gi.require_version('NMClient', '1.0') before import to ensure that the right version gets loaded.\r\n  from gi.repository import NetworkManager, NMClient\r\nTraceback (most recent call last):\r\n  File \"/tmp/ansible_PpATO0/ansible_module_nmcli.py\", line 1190, in <module>\r\n    main()\r\n  File \"/tmp/ansible_PpATO0/ansible_module_nmcli.py\", line 1134, in main\r\n    nmcli=Nmcli(module)\r\n  File \"/tmp/ansible_PpATO0/ansible_module_nmcli.py\", line 559, in __init__\r\n    self.dns4=' '.join(module.params['dns4'])\r\nTypeError\r\n", "msg": "MODULE FAILURE", "rc": 0}

# Fixed code
def __init__(self, module):
    self.module = module
    self.state = module.params["state"]
    self.autoconnect = module.params["autoconnect"]
    self.conn_name = module.params["conn_name"]
    self.master = module.params["master"]
    self.ifname = module.params["ifname"]
    self.type = module.params["type"]
    self.ip4 = module.params["ip4"]
    self.gw4 = module.params["gw4"]
    self.dns4 = " ".join(module.params["dns4"]) if module.params.get("dns4") else None
    self.dns4_search = (
        " ".join(module.params["dns4_search"])
        if module.params.get("dns4_search")
        else None
    )
    self.ip6 = module.params["ip6"]
    self.gw6 = module.params["gw6"]
    self.dns6 = module.params["dns6"]
    self.dns6_search = (
        " ".join(module.params["dns6_search"])
        if module.params.get("dns6_search")
        else None
    )
    self.mtu = module.params["mtu"]
    self.stp = module.params["stp"]
    self.priority = module.params["priority"]
    self.mode = module.params["mode"]
    self.miimon = module.params["miimon"]
    self.primary = module.params["primary"]
    self.downdelay = module.params["downdelay"]
    self.updelay = module.params["updelay"]
    self.arp_interval = module.params["arp_interval"]
    self.arp_ip_target = module.params["arp_ip_target"]
    self.slavepriority = module.params["slavepriority"]
    self.forwarddelay = module.params["forwarddelay"]
    self.hellotime = module.params["hellotime"]
    self.maxage = module.params["maxage"]
    self.ageingtime = module.params["ageingtime"]
    self.hairpin = module.params["hairpin"]
    self.path_cost = module.params["path_cost"]
    self.mac = module.params["mac"]
    self.vlanid = module.params["vlanid"]
    self.vlandev = module.params["vlandev"]
    self.flags = module.params["flags"]
    self.ingress = module.params["ingress"]
    self.egress = module.params["egress"]
    self.nmcli_bin = self.module.get_bin_path("nmcli", True)