+#include <stdexcept>
+
+typedef std::pair<std::string const, std::string> pair_string;
+
+struct pair_string_to_tuple
+{
+ static PyObject * convert(pair_string const &p) {
+ PyObject *key = PyString_FromString(p.first.c_str());
+ PyObject *value = PyString_FromString(p.second.c_str());
+ PyObject *tuple = PyTuple_New(2);
+ if (key == 0 or value == 0 or tuple == 0)
+ throw std::runtime_error("Allocation Error");
+
+ PyTuple_SetItem(tuple, 0, key);
+ PyTuple_SetItem(tuple, 1, value);
+ return tuple;
+ }
+};
+