diff --git a/bson/_cbsonmodule.c b/bson/_cbsonmodule.c
index bdd987e..6ec0d64 100644
--- a/bson/_cbsonmodule.c
+++ b/bson/_cbsonmodule.c
@@ -1035,14 +1035,16 @@ int write_dict(PyObject* self, buffer_t buffer, PyObject* dict,
     return 1;
 }
 
-static PyObject* _cbson_dict_to_bson(PyObject* self, PyObject* args) {
+static PyObject* _cbson_dict_to_bson(PyObject* self, PyObject* args, PyObject* kwargs) {
     PyObject* dict;
     PyObject* result;
     unsigned char check_keys;
     unsigned char uuid_subtype;
+    unsigned char top_level = 1;
     buffer_t buffer;
+    char *keywords[] = { "dict", "check_keys", "uuid_subtype", "top_level", NULL };
 
-    if (!PyArg_ParseTuple(args, "Obb", &dict, &check_keys, &uuid_subtype)) {
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Obb|b", keywords, &dict, &check_keys, &uuid_subtype, &top_level)) {
         return NULL;
     }
 
@@ -1052,7 +1054,7 @@ static PyObject* _cbson_dict_to_bson(PyObject* self, PyObject* args) {
         return NULL;
     }
 
-    if (!write_dict(self, buffer, dict, check_keys, uuid_subtype, 1)) {
+    if (!write_dict(self, buffer, dict, check_keys, uuid_subtype, top_level)) {
         buffer_free(buffer);
         return NULL;
     }
@@ -1730,7 +1732,7 @@ static PyObject* _cbson_decode_all(PyObject* self, PyObject* args) {
 }
 
 static PyMethodDef _CBSONMethods[] = {
-    {"_dict_to_bson", _cbson_dict_to_bson, METH_VARARGS,
+    {"_dict_to_bson", (PyCFunction) _cbson_dict_to_bson, METH_VARARGS|METH_KEYWORDS,
      "convert a dictionary to a string containing its BSON representation."},
     {"_bson_to_dict", _cbson_bson_to_dict, METH_VARARGS,
      "convert a BSON string to a SON object."},
