'A context manager for temporarily setting the branch value for the store to the given branch_setting.'

@contextmanager
def branch_setting(self, branch_setting, course_id=None):

    if (branch_setting != ModuleStoreEnum.Branch.published_only):
        raise ValueError(u'Cannot    set    branch    setting    to    {}    on    a    ReadOnly    store'.format(branch_setting))
    (yield)
