code: def find_one(self, filter=None, *args, **kwargs):
          
          if (filter is not None and not
                  isinstance(filter, collections.Mapping)):
              filter = {"_id": filter}
  
          cursor = self.find(filter, *args, **kwargs)
          for result in cursor.limit(-1):
              return result
          return None
docs: Get a single document from the database.
  
          All arguments to :meth:`find` are also valid arguments for
          :meth:`find_one`, although any `limit` argument will be
          ignored. Returns a single document, or ``None`` if no matching
          document is found.
  
          The :meth:`find_one` method obeys the :attr:`read_preference` of
          this :class:`Collection`.
  
          :Parameters:
  
            - `filter` (optional): a dictionary specifying
              the query to be performed OR any other type to be used as
              the value for a query for ``"_id"``.
  
            - `*args` (optional): any additional positional arguments
              are the same as the arguments to :meth:`find`.
  
            - `**kwargs` (optional): any additional keyword arguments
              are the same as the arguments to :meth:`find`.
  
                >>> collection.find_one(max_time_ms=100)