'Given a transaction object and a list of Datasets, return
a mapping from Dataset ids to whether the Dataset is public
or not. All Dataset ids should be returned in the mapping\'s keys.'

def datasets_are_public(self, trans, datasets):

    datasets_public = {}
    dataset_ids = [dataset.id for dataset in datasets]
    for dataset_id in dataset_ids:
        datasets_public[dataset_id] = True
    access_data_perms = trans.sa_session.query(trans.app.model.DatasetPermissions).filter(and_(trans.app.model.DatasetPermissions.dataset_id.in_(dataset_ids), (trans.app.model.DatasetPermissions.action == self.permitted_actions.DATASET_ACCESS.action))).all()
    for permission in access_data_perms:
        datasets_public[permission.dataset_id] = False
    return datasets_public
