<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_by_name(collection, name, exact=True):
 """ 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. """

    params = {'filter[]': ['name==%s' % name]}
    found = collection.index(params=params)
    if not exact and len(found) > 0:
        return found
    for f in found:
        if f.soul['name'] == name:
            return f