<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_record(self, collection_name, query):
 """ Return the first record mathing the given Mongo query. :param collection_name: Name of the collection to search in. :param query: MongoDB Query, e.g. {_id: 123} :return: A single MongoDB record or None if not found. :raise DataSourceError """

        cursor = self._get_collection(collection_name).find(query)
        for record in cursor:
            # Return the first record found.
            return record
        # Return None if nothing found.
        return None