def insert(self, doc_or_docs,<EOL>manipulate=True, safe=True, check_keys=True, callback=None, **kwargs):
if not isinstance(safe, bool):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>docs = doc_or_docs<EOL>if isinstance(docs, dict):<EOL><INDENT>docs = [docs]<EOL><DEDENT>self.__limit = None<EOL>if kwargs:<EOL><INDENT>safe = True<EOL><DEDENT>if safe and not callable(callback):<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if not safe and callback is not None:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>if callback:<EOL><INDENT>callback = functools.partial(self._handle_response, orig_callback=callback)<EOL><DEDENT>connection = self.__pool.connection()<EOL>try:<EOL><INDENT>connection.send_message(<EOL>message.insert(self.full_collection_name, docs,<EOL>check_keys, safe, kwargs), callback=callback)<EOL><DEDENT>except:<EOL><INDENT>connection.close()<EOL>raise<EOL><DEDENT>
Insert a document(s) into this collection.

        If `manipulate` is set, the document(s) are manipulated using
        any :class:`~pymongo.son_manipulator.SONManipulator` instances
        that have been added to this
        :class:`~pymongo.database.Database`. Returns the ``"_id"`` of
        the inserted document or a list of ``"_id"`` values of the
        inserted documents.  If the document(s) does not already
        contain an ``"_id"`` one will be added.

        If `safe` is ``True`` then the insert will be checked for
        errors, raising :class:`~pymongo.errors.OperationFailure` if
        one occurred. Safe inserts wait for a response from the
        database, while normal inserts do not.

        Any additional keyword arguments imply ``safe=True``, and
        will be used as options for the resultant `getLastError`
        command. For example, to wait for replication to 3 nodes, pass
        ``w=3``.

        :Parameters:
          - `doc_or_docs`: a document or list of documents to be
            inserted
          - `manipulate` (optional): manipulate the documents before
            inserting?
          - `safe` (optional): check that the insert succeeded?
          - `check_keys` (optional): check if keys start with '$' or
            contain '.', raising :class:`~pymongo.errors.InvalidName`
            in either case
          - `**kwargs` (optional): any additional arguments imply
            ``safe=True``, and will be used as options for the
            `getLastError` command

        .. mongodoc:: insert