def find_by_name(collection, name, exact=True):
params = {'<STR_LIT>': ['<STR_LIT>' % name]}<EOL>found = collection.index(params=params)<EOL>if not exact and len(found) > <NUM_LIT:0>:<EOL><INDENT>return found<EOL><DEDENT>for f in found:<EOL><INDENT>if f.soul['<STR_LIT:name>'] == name:<EOL><INDENT>return f<EOL><DEDENT><DEDENT>
Searches collection by resource name.

:param rightscale.ResourceCollection collection: The collection in which to
    look for :attr:`name`.

:param str name: The name to look for in collection.

:param bool exact: A RightScale ``index`` search with a :attr:`name` filter
    can return multiple results because it does a substring match on
    resource names.  So any resource that contains the specified name will
    be returned.  The :attr:`exact` flag controls whether to attempt to
    find an exact match for the given name.  If :attr:`exact` is ``False``,
    this will return a list of all the matches.  The default behaviour is
    to perform an exact match and return a single result.

Returns ``None`` if no resources are found with a matching name.