'Vars in a play can be specified either as a dictionary directly, or
as a list of dictionaries. If the later, this method will turn the
list into a single dictionary.'

def _load_vars(self, attr, ds):

    def _validate_variable_keys(ds):
        for key in ds:
            if (not isidentifier(key)):
                raise TypeError(("'%s'    is    not    a    valid    variable    name" % key))
    try:
        if isinstance(ds, dict):
            _validate_variable_keys(ds)
            return ds
        elif isinstance(ds, list):
            all_vars = dict()
            for item in ds:
                if (not isinstance(item, dict)):
                    raise ValueError
                _validate_variable_keys(item)
                all_vars = combine_vars(all_vars, item)
            return all_vars
        elif (ds is None):
            return {}
        else:
            raise ValueError
    except ValueError as e:
        raise AnsibleParserError(('Vars    in    a    %s    must    be    specified    as    a    dictionary,    or    a    list    of    dictionaries' % self.__class__.__name__), obj=ds, orig_exc=e)
    except TypeError as e:
        raise AnsibleParserError(('Invalid    variable    name    in    vars    specified    for    %s:    %s' % (self.__class__.__name__, e)), obj=ds, orig_exc=e)
