code: def _parse_group(self, group_name, group):
          
          if type(group) == dict:
              # Example:
              #     {
              #       "mgmt": {
              #         "hosts": [ "mgmt01", "mgmt02" ],
              #         "vars": {
              #           "eth0": {
              #             "onboot": "yes",
              #             "nm_controlled": "no"
              #           }
              #         }
              #       }
              #     }
              #
              hostnames_in_group = set()
  
              # Group member with hosts and variable definitions.
              for hostname in group.get('hosts', []):
                  self._get_host(hostname)['groups'].add(group_name)
                  hostnames_in_group.add(hostname)
              # Apply variables to all hosts in group
              for var_key, var_val in group.get('vars', {}).items():
                  for hostname in hostnames_in_group:
                      self._get_host(hostname)['hostvars'][var_key] = var_val
          elif type(group) == list:
              # List of hostnames for this group
              for hostname in group:
                  self._get_host(hostname)['groups'].add(group_name)
          else:
              self.log.warning("Invalid element found in dynamic inventory output: {0}".format(type(group)))
docs: Parse a group definition from a dynamic inventory. These are top-level
          elements which are not '_meta(data)'.