def insert(collection_name, docs, check_keys, safe, last_error_args):
data = __ZERO<EOL>data += bson._make_c_string(collection_name)<EOL>bson_data = "<STR_LIT>".join([bson.BSON.encode(doc, check_keys) for doc in docs])<EOL>if not bson_data:<EOL><INDENT>raise InvalidOperation("<STR_LIT>")<EOL><DEDENT>data += bson_data<EOL>if safe:<EOL><INDENT>(_, insert_message) = __pack_message(<NUM_LIT>, data)<EOL>(request_id, error_message) = __last_error(last_error_args)<EOL>return (request_id, insert_message + error_message)<EOL><DEDENT>else:<EOL><INDENT>return __pack_message(<NUM_LIT>, data)<EOL><DEDENT>
Get an **insert** message.