<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _parse_groupvar_dir(self, inventory_path):
 """ Parse group_vars dir, if it exists. Encrypted vault files are skipped. """

        # inventory_path could point to a `hosts` file, or to a dir. So we
        # construct the location to the `group_vars` differently.
        if os.path.isdir(inventory_path):
            path = os.path.join(inventory_path, 'group_vars')
        else:
            path = os.path.join(os.path.dirname(inventory_path), 'group_vars')

        self.log.debug("Parsing group vars (dir): {0}".format(path))
        if not os.path.exists(path):
            self.log.info("No such dir {0}".format(path))
            return

        for (dirpath, dirnames, filenames) in os.walk(path):
            for filename in filenames:
                full_path = os.path.join(dirpath, filename)

                # filename is the group name
                groupname = strip_exts(filename, ('.yml', '.yaml', '.json'))

                try:
                    self.log.debug("Reading group vars from {}".format(full_path))
                    f = codecs.open(full_path, 'r', encoding='utf8')
                    invars = ihateyaml.safe_load(f)
                    f.close()
                except Exception as err:
                    # Just catch everything because yaml...
                    self.log.warning("Yaml couldn't load '{0}' because '{1}'. Skipping".format(full_path, err))
                    continue  # Go to next file

                if groupname == 'all':
                    # groupname 'all' is special and applies to all hosts.
                    for hostname in self.hosts_all():
                        self.update_host(hostname, {'hostvars': invars}, overwrite=False)
                else:
                    for hostname in self.hosts_in_group(groupname):
                        self.update_host(hostname, {'hostvars': invars}, overwrite=False)