code: def _raise_document_too_large(operation, doc_size, max_size):
      
      if operation == "insert":
          raise DocumentTooLarge("BSON document too large (%d bytes)"
                                 " - the connected server supports"
                                 " BSON document sizes up to %d"
                                 " bytes." % (doc_size, max_size))
      else:
          # There's nothing intelligent we can say
          # about size for update and delete
          raise DocumentTooLarge("%r command document too large" % (operation,))
docs: Internal helper for raising DocumentTooLarge.