<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_id(self, _id, projection=None):
 """find record by _id """

        if isinstance(_id, list) or isinstance(_id, tuple):
            return list(self.__collect.find(
                {'_id': {'$in': [self._to_primary_key(i) for i in _id]}}, projection))

        document_id = self._to_primary_key(_id)

        if document_id is None:
            return None

        return self.__collect.find_one({'_id': document_id}, projection)