+static PyObject*
+pyobj_from_banlist(struct banList* bans) {
+ size_t n;
+ struct banNode* bn;
+ PyObject* tmp;
+ PyObject* retval = PyTuple_New(bans->used);
+
+ if (retval == NULL)
+ return NULL;
+
+ for (n = 0; n < bans->used; ++n) {
+ bn = bans->list[n];
+
+ tmp = Py_BuildValue("{s:s,s:s,s:l}",
+ "ban", bn->ban, "who", bn->who, "set", bn->set);
+
+ if (tmp == NULL || PyTuple_SetItem(retval, n, tmp)) {
+ pyobj_release_tuple(retval, n);
+ return NULL;
+ }
+ }
+
+ return retval;
+}
+
+static PyObject*
+pyobj_from_exemptlist(struct exemptList* exmp) {
+ size_t n;
+ struct exemptNode* en;
+ PyObject* tmp;
+ PyObject* retval = PyTuple_New(exmp->used);
+
+ if (retval == NULL)
+ return NULL;
+
+ for (n = 0; n < exmp->used; ++n) {
+ en = exmp->list[n];
+
+ tmp = Py_BuildValue("{s:s,s:s,s:l}",
+ "ban", en->exempt, "who", en->who, "set", en->set);
+
+ if (tmp == NULL || PyTuple_SetItem(retval, n, tmp)) {
+ pyobj_release_tuple(retval, n);
+ return NULL;
+ }
+ }
+
+ return retval;
+}
+