def coerce_feature_branch(value):
<EOL>if isinstance(value, FeatureBranchSpec):<EOL><INDENT>return value<EOL><DEDENT>if not isinstance(value, string_types):<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise ValueError(msg % type(value))<EOL><DEDENT>return FeatureBranchSpec(expression=value)<EOL>
Convert a string to a :class:`FeatureBranchSpec` object.

:param value: A string or :class:`FeatureBranchSpec` object.
:returns: A :class:`FeatureBranchSpec` object.