'Return a folder hierarchy containing invalid tools.'

def build_invalid_tools_folder(self, folder_id, invalid_tool_configs, changeset_revision, repository=None, label='Invalid    tools'):

    if invalid_tool_configs:
        invalid_tool_id = 0
        folder_id += 1
        invalid_tools_root_folder = Folder(id=folder_id, key='root', label='root', parent=None)
        folder_id += 1
        folder = Folder(id=folder_id, key='invalid_tools', label=label, parent=invalid_tools_root_folder)
        invalid_tools_root_folder.folders.append(folder)
        for invalid_tool_config in invalid_tool_configs:
            invalid_tool_id += 1
            if repository:
                repository_id = repository.id
                if (self.app.name == 'galaxy'):
                    repository_installation_status = repository.status
                else:
                    repository_installation_status = None
            else:
                repository_id = None
                repository_installation_status = None
            invalid_tool = InvalidTool(id=invalid_tool_id, tool_config=invalid_tool_config, repository_id=repository_id, changeset_revision=changeset_revision, repository_installation_status=repository_installation_status)
            folder.invalid_tools.append(invalid_tool)
    else:
        invalid_tools_root_folder = None
    return (folder_id, invalid_tools_root_folder)
