'Overrides the base load_data(), as we\'re actually going to return a new
Playbook() object rather than a PlaybookInclude object'

def load_data(self, ds, basedir, variable_manager=None, loader=None):

    from ansible.playbook import Playbook
    from ansible.playbook.play import Play
    new_obj = super(PlaybookInclude, self).load_data(ds, variable_manager, loader)
    all_vars = self.vars.copy()
    if variable_manager:
        all_vars.update(variable_manager.get_vars())
    templar = Templar(loader=loader, variables=all_vars)
    pb = Playbook(loader=loader)
    file_name = templar.template(new_obj.import_playbook)
    if (not os.path.isabs(file_name)):
        file_name = os.path.join(basedir, file_name)
    pb._load_playbook_data(file_name=file_name, variable_manager=variable_manager)
    for entry in pb._entries:
        if (new_obj.when and isinstance(entry, Play)):
            entry._included_conditional = new_obj.when[:]
        temp_vars = entry.vars.copy()
        temp_vars.update(new_obj.vars)
        param_tags = temp_vars.pop('tags', None)
        if (param_tags is not None):
            entry.tags.extend(param_tags.split(','))
        entry.vars = temp_vars
        entry.tags = list(set(entry.tags).union(new_obj.tags))
        if (entry._included_path is None):
            entry._included_path = os.path.dirname(file_name)
        if new_obj.when:
            for task_block in (((entry.pre_tasks + entry.roles) + entry.tasks) + entry.post_tasks):
                task_block._attributes['when'] = (new_obj.when[:] + task_block.when[:])
    return pb
