'If is_locked is True, xblock is staff locked. Otherwise, the xblock staff lock field is removed.'

def _set_staff_lock(self, xblock, is_locked):

    field = xblock.fields['visible_to_staff_only']
    if is_locked:
        field.write_to(xblock, True)
    else:
        field.delete_from(xblock)
    return self.store.update_item(xblock, ModuleStoreEnum.UserID.test)
