# Buggy code
def get_item(self):
    self.log("Get properties for {0}".format(self.name))
    item = None
    result = []

    try:
        item = self.compute_client.virtual_machines.get(self.resource_group, self.name)
    except CloudError as err:
        self.module.warn(
            "Error getting virtual machine {0} - {1}".format(self.name, str(err))
        )

    if item and self.has_tags(item.tags, self.tags):
        result = [self.serialize_vm(item)]

    return result


# Traceback (msrest.exceptions.ValidationError)
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "No handlers could be found for logger \"msrestazure.azure_active_directory\"\nTraceback (most recent call last):\n
File \"/tmp/ansible-tmp-1552941958.2-220411846899861/AnsiballZ_azure_rm_virtualmachine_facts.py\", line 113, in <module>\n    _ansiballz_main()\n
File \"/tmp/ansible-tmp-1552941958.2-220411846899861/AnsiballZ_azure_rm_virtualmachine_facts.py\", line 105, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n
File \"/tmp/ansible-tmp-1552941958.2-220411846899861/AnsiballZ_azure_rm_virtualmachine_facts.py\", line 48, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n
File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload__muqp2/__main__.py\", line 347, in <module>\n    \n  File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload__muqp2/__main__.py\", line 343, in main\n    \n
File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload__muqp2/__main__.py\", line 224, in __init__\n    \n
File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload__muqp2/ansible_azure_rm_virtualmachine_facts_payload.zip/ansible/module_utils/azure_rm_common.py\", line 308, in __init__\n
File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload__muqp2/__main__.py\", line 236, in exec_module\n    \n
File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload__muqp2/__main__.py\", line 263, in list_items\n    \n
File \"/home/svc_ucoansible/.local/lib/python2.7/site-packages/msrest/paging.py\", line 121, in __next__\n    self.advance_page()\n
File \"/home/svc_ucoansible/.local/lib/python2.7/site-packages/msrest/paging.py\", line 107, in advance_page\n    self._response = self._get_next(self.next_link)\n
File \"/home/svc_ucoansible/.local/lib/python2.7/site-packages/azure/mgmt/compute/compute/v2017_03_30/operations/virtual_machines_operations.py\", line 664, in internal_paging\n    'resourceGroupName': self._serialize.url(\"resource_group_name\", resource_group_name, 'str'),\n
File \"/home/svc_ucoansible/.local/lib/python2.7/site-packages/msrest/serialization.py\", line 488, in url\n    data = self.validate(data, name, required=True, **kwargs)\n
File \"/home/svc_ucoansible/.local/lib/python2.7/site-packages/msrest/serialization.py\", line 558, in validate\n    raise ValidationError(\"required\", name, True)\n
msrest.exceptions.ValidationError: Parameter 'resource_group_name' can not be None.\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1}
to retry, use: --limit @/opt/automation/Ansible/find-config.retry

# Fixed code
def get_item(self):
    self.log("Get properties for {0}".format(self.name))
    item = None
    result = []

    item = self.get_vm(self.resource_group, self.name)

    if item and self.has_tags(item.get("tags"), self.tags):
        result = [item]

    return result