def coerce_author(value):
<EOL>if isinstance(value, Author):<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>match = re.match('<STR_LIT>', value)<EOL>if not match:<EOL><INDENT>msg = "<STR_LIT>"<EOL>raise ValueError(msg % value)<EOL><DEDENT>return Author(<EOL>name=match.group(<NUM_LIT:1>).strip(),<EOL>email=match.group(<NUM_LIT:2>).strip(),<EOL>)<EOL>
Coerce strings to :class:`Author` objects.

:param value: A string or :class:`Author` object.
:returns: An :class:`Author` object.
:raises: :exc:`~exceptions.ValueError` when `value`
         isn't a string or :class:`Author` object.