'This is a helper loading function for the dependencies list,
which returns a list of RoleInclude objects'

def _load_dependencies(self, attr, ds):

    roles = []
    if ds:
        if (not isinstance(ds, list)):
            raise AnsibleParserError('Expected    role    dependencies    to    be    a    list.', obj=self._ds)
        for role_def in ds:
            if (isinstance(role_def, string_types) or ('role' in role_def) or ('name' in role_def)):
                roles.append(role_def)
                continue
            try:
                def_parsed = RoleRequirement.role_yaml_parse(role_def)
                if def_parsed.get('name'):
                    role_def['name'] = def_parsed['name']
                roles.append(role_def)
            except AnsibleError as exc:
                raise AnsibleParserError(str(exc), obj=role_def, orig_exc=exc)
    current_role_path = None
    if self._owner:
        current_role_path = os.path.dirname(self._owner._role_path)
    try:
        return load_list_of_roles(roles, play=self._owner._play, current_role_path=current_role_path, variable_manager=self._variable_manager, loader=self._loader)
    except AssertionError as e:
        raise AnsibleParserError('A    malformed    list    of    role    dependencies    was    encountered.', obj=self._ds, orig_exc=e)
