def create_bundle_mop_logout(user_id, session_key): bundle_id = 'b:%s/logout' % session_key b = ProvBundle(namespaces=DEFAULT_NAMESPACES) b.add_namespace('ns', b.valid_identifier(bundle_id + '/').get_uri()) ag = b.agent('mopuser:%d/%s' % (user_id, session_key)) now = datetime.datetime.now() a = b.activity('log:%d/login/%s' % (user_id, session_key), now, now, other_attributes=[('prov:type', 'act:MopAccountLogout')]) b.wasInvalidatedBy(ag, a) # This user+session no longer exists after this return bundle_id, b