# Buggy code
def modify_connection(self):
    cmd = []
    if self.type == "team":
        cmd = self.modify_connection_team()
    elif self.type == "team-slave":
        cmd = self.modify_connection_team_slave()
    elif self.type == "bond":
        cmd = self.modify_connection_bond()
    elif self.type == "bond-slave":
        cmd = self.modify_connection_bond_slave()
    elif self.type == "ethernet":
        cmd = self.modify_connection_ethernet()
    elif self.type == "bridge":
        cmd = self.modify_connection_bridge()
    elif self.type == "vlan":
        cmd = self.modify_connection_vlan()
    elif self.type == "generic":
        cmd = self.modify_connection_ethernet(conn_type="generic")
    if cmd:
        return self.execute_command(cmd)
    else:
        self.module.fail_json(
            msg="Type of device or network connection is required "
            "while performing 'modify' operation. Please specify 'type' as an argument."
        )


# 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 modify_connection(self):
    cmd = []
    if self.type == "team":
        cmd = self.modify_connection_team()
    elif self.type == "team-slave":
        cmd = self.modify_connection_team_slave()
    elif self.type == "bond":
        cmd = self.modify_connection_bond()
    elif self.type == "bond-slave":
        cmd = self.modify_connection_bond_slave()
    elif self.type == "ethernet":
        cmd = self.modify_connection_ethernet()
    elif self.type == "bridge":
        cmd = self.modify_connection_bridge()
    elif self.type == "bridge-slave":
        cmd = self.modify_connection_bridge_slave()
    elif self.type == "vlan":
        cmd = self.modify_connection_vlan()
    elif self.type == "generic":
        cmd = self.modify_connection_ethernet(conn_type="generic")
    if cmd:
        return self.execute_command(cmd)
    else:
        self.module.fail_json(
            msg="Type of device or network connection is required "
            "while performing 'modify' operation. Please specify 'type' as an argument."
        )