#include "foomodule4.h"



static int
_wrap_PyTopNsPrefixBottomNsPrefixInner__tp_init__0(PyTopNsPrefixBottomNsPrefixInner *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyTopNsPrefixBottomNsPrefixInner *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyTopNsPrefixBottomNsPrefixInner_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new TopNs::PrefixBottomNs::PrefixInner(*((PyTopNsPrefixBottomNsPrefixInner *) arg0)->obj);
    return 0;
}

static int
_wrap_PyTopNsPrefixBottomNsPrefixInner__tp_init__1(PyTopNsPrefixBottomNsPrefixInner *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new TopNs::PrefixBottomNs::PrefixInner();
    return 0;
}

int _wrap_PyTopNsPrefixBottomNsPrefixInner__tp_init(PyTopNsPrefixBottomNsPrefixInner *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyTopNsPrefixBottomNsPrefixInner__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyTopNsPrefixBottomNsPrefixInner__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyTopNsPrefixBottomNsPrefixInner_Do(PyTopNsPrefixBottomNsPrefixInner *self)
{
    PyObject *py_retval;
    
    self->obj->Do();
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


static PyObject*
_wrap_PyTopNsPrefixBottomNsPrefixInner__copy__(PyTopNsPrefixBottomNsPrefixInner *self)
{

    PyTopNsPrefixBottomNsPrefixInner *py_copy;
    py_copy = PyObject_New(PyTopNsPrefixBottomNsPrefixInner, &PyTopNsPrefixBottomNsPrefixInner_Type);
    py_copy->obj = new TopNs::PrefixBottomNs::PrefixInner(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyTopNsOuterBase_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyTopNsPrefixBottomNsPrefixInner_methods[] = {
    {(char *) "Do", (PyCFunction) _wrap_PyTopNsPrefixBottomNsPrefixInner_Do, METH_NOARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyTopNsPrefixBottomNsPrefixInner__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyTopNsPrefixBottomNsPrefixInner__tp_dealloc(PyTopNsPrefixBottomNsPrefixInner *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyTopNsOuterBase_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyTopNsOuterBase_wrapper_registry.end()) {
        PyTopNsOuterBase_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        TopNs::PrefixBottomNs::PrefixInner *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyTopNsPrefixBottomNsPrefixInner__tp_richcompare (PyTopNsPrefixBottomNsPrefixInner *PYBINDGEN_UNUSED(self), PyTopNsPrefixBottomNsPrefixInner *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyTopNsPrefixBottomNsPrefixInner_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyTopNsPrefixBottomNsPrefixInner_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.TopNs.PrefixBottomNs.PrefixInner",            /* tp_name */
    sizeof(PyTopNsPrefixBottomNsPrefixInner),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyTopNsPrefixBottomNsPrefixInner__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyTopNsPrefixBottomNsPrefixInner__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyTopNsPrefixBottomNsPrefixInner_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyTopNsPrefixBottomNsPrefixInner__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyTopNsOuterBase_wrapper_registry;


static int
_wrap_PyTopNsOuterBase__tp_init__0(PyTopNsOuterBase *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new TopNs::OuterBase();
    return 0;
}

static int
_wrap_PyTopNsOuterBase__tp_init__1(PyTopNsOuterBase *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyTopNsOuterBase *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyTopNsOuterBase_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new TopNs::OuterBase(*((PyTopNsOuterBase *) arg0)->obj);
    return 0;
}

int _wrap_PyTopNsOuterBase__tp_init(PyTopNsOuterBase *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyTopNsOuterBase__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyTopNsOuterBase__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


static PyObject*
_wrap_PyTopNsOuterBase__copy__(PyTopNsOuterBase *self)
{

    PyTopNsOuterBase *py_copy;
    py_copy = PyObject_New(PyTopNsOuterBase, &PyTopNsOuterBase_Type);
    py_copy->obj = new TopNs::OuterBase(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyTopNsOuterBase_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyTopNsOuterBase_methods[] = {
    {(char *) "__copy__", (PyCFunction) _wrap_PyTopNsOuterBase__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyTopNsOuterBase__tp_dealloc(PyTopNsOuterBase *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyTopNsOuterBase_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyTopNsOuterBase_wrapper_registry.end()) {
        PyTopNsOuterBase_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        TopNs::OuterBase *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyTopNsOuterBase__tp_richcompare (PyTopNsOuterBase *PYBINDGEN_UNUSED(self), PyTopNsOuterBase *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyTopNsOuterBase_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyTopNsOuterBase_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.TopNs.OuterBase",            /* tp_name */
    sizeof(PyTopNsOuterBase),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyTopNsOuterBase__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyTopNsOuterBase__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyTopNsOuterBase_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyTopNsOuterBase__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



PyObject *
_wrap_foo4_xptoset_foo_type_ptr(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    xpto::FooType  type;
    const char *keywords[] = {"type", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &type)) {
        return NULL;
    }
    xpto::set_foo_type_ptr(&type);
    py_retval = Py_BuildValue((char *) "i", type);
    return py_retval;
}


PyObject *
_wrap_foo4_xptoset_foo_type(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    xpto::FooType type;
    const char *keywords[] = {"type", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &type)) {
        return NULL;
    }
    xpto::set_foo_type(type);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_foo4_xptosome_function()
{
    PyObject *py_retval;
    std::string retval;
    
    retval = xpto::some_function();
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


PyObject *
_wrap_foo4_xptoset_foo_type_inout(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    xpto::FooType  type;
    const char *keywords[] = {"type", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &type)) {
        return NULL;
    }
    xpto::set_foo_type_inout(type);
    py_retval = Py_BuildValue((char *) "i", type);
    return py_retval;
}


std::map<void*, PyObject*> PyXptoSomeClass_wrapper_registry;


static int
_wrap_PyXptoSomeClass__tp_init__0(PyXptoSomeClass *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyXptoSomeClass *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyXptoSomeClass_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new xpto::SomeClass(*((PyXptoSomeClass *) arg0)->obj);
    return 0;
}

static int
_wrap_PyXptoSomeClass__tp_init__1(PyXptoSomeClass *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new xpto::SomeClass();
    return 0;
}

int _wrap_PyXptoSomeClass__tp_init(PyXptoSomeClass *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyXptoSomeClass__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyXptoSomeClass__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


static PyObject*
_wrap_PyXptoSomeClass__copy__(PyXptoSomeClass *self)
{

    PyXptoSomeClass *py_copy;
    py_copy = PyObject_New(PyXptoSomeClass, &PyXptoSomeClass_Type);
    py_copy->obj = new xpto::SomeClass(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyXptoSomeClass_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyXptoSomeClass_methods[] = {
    {(char *) "__copy__", (PyCFunction) _wrap_PyXptoSomeClass__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyXptoSomeClass__tp_dealloc(PyXptoSomeClass *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyXptoSomeClass_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyXptoSomeClass_wrapper_registry.end()) {
        PyXptoSomeClass_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        xpto::SomeClass *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyXptoSomeClass__tp_richcompare (PyXptoSomeClass *PYBINDGEN_UNUSED(self), PyXptoSomeClass *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyXptoSomeClass_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyXptoSomeClass_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.xpto.SomeClass",            /* tp_name */
    sizeof(PyXptoSomeClass),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyXptoSomeClass__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyXptoSomeClass__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyXptoSomeClass_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyXptoSomeClass__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



PyObject *
_wrap_foo4my_inverse_func(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    double retval;
    double x;
    const char *keywords[] = {"x", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "d", (char **) keywords, &x)) {
        return NULL;
    }
    try
    {
        retval = my_inverse_func(x);
    } catch (DomainError const &exc) {
        PyErr_SetNone((PyObject *) PyDomainError_Type);
        return NULL;
    }
    py_retval = Py_BuildValue((char *) "d", retval);
    return py_retval;
}


PyObject *
_wrap_foo4print_something(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    char const *message;
    const char *keywords[] = {"message", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s", (char **) keywords, &message)) {
        return NULL;
    }
    retval = print_something(message);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_foo4my_inverse_func2(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    double retval;
    double x;
    const char *keywords[] = {"x", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "d", (char **) keywords, &x)) {
        return NULL;
    }
    try
    {
        retval = my_inverse_func2(x);
    } catch (std::exception const &exc) {
        PyErr_SetString((PyObject *) Pystd__exception_Type, exc.what());
        return NULL;
    }
    py_retval = Py_BuildValue((char *) "d", retval);
    return py_retval;
}


PyObject *
_wrap_foo4take_some_object()
{
    PyObject *py_retval;
    SomeObject *retval;
    PySomeObject *py_SomeObject;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    
    retval = take_some_object();
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    if (typeid((*retval)) == typeid(PySomeObject__PythonHelper))
    {
        py_SomeObject = reinterpret_cast< PySomeObject* >(reinterpret_cast< PySomeObject__PythonHelper* >(retval)->m_pyself);
        py_SomeObject->obj = retval;
        Py_INCREF(py_SomeObject);
    } else {
        wrapper_lookup_iter = PySomeObject_wrapper_registry.find((void *) retval);
        if (wrapper_lookup_iter == PySomeObject_wrapper_registry.end()) {
            py_SomeObject = NULL;
        } else {
            py_SomeObject = (PySomeObject *) wrapper_lookup_iter->second;
            Py_INCREF(py_SomeObject);
        }
    
        if (py_SomeObject == NULL) {
            py_SomeObject = PyObject_GC_New(PySomeObject, &PySomeObject_Type);
            py_SomeObject->inst_dict = NULL;
            py_SomeObject->obj = retval;
            py_SomeObject->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
            PySomeObject_wrapper_registry[(void *) py_SomeObject->obj] = (PyObject *) py_SomeObject;
        }
    }
    py_retval = Py_BuildValue((char *) "N", py_SomeObject);
    return py_retval;
}


PyObject *
_wrap_foo4set_foobar_with_other_as_custodian(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyFoobar *foobar;
    Foobar *foobar_ptr;
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    PySomeObject *other;
    SomeObject *other_ptr;
    PyObject *wards;
    const char *keywords[] = {"foobar", "other", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!O!", (char **) keywords, &PyFoobar_Type, &foobar, &PySomeObject_Type, &other)) {
        return NULL;
    }
    foobar_ptr = (foobar ? foobar->obj : NULL);
    other_ptr = (other ? other->obj : NULL);
    wards = PyObject_GetAttrString(((PyObject *) other), (char *) "__wards__");
    if (wards == NULL) {
        PyErr_Clear();
        wards = PyList_New(0);
        PyObject_SetAttrString(((PyObject *) other), (char *) "__wards__", wards);
    }
    if (((PyObject *) foobar) && !PySequence_Contains(wards, ((PyObject *) foobar)))
        PyList_Append(wards, ((PyObject *) foobar));
    set_foobar_with_other_as_custodian(foobar_ptr, other_ptr);
    if (foobar) {
        wrapper_lookup_iter = PyFoobar_wrapper_registry.find((void *) foobar->obj);
        if (wrapper_lookup_iter != PyFoobar_wrapper_registry.end()) {
            PyFoobar_wrapper_registry.erase(wrapper_lookup_iter);
        }
    
        foobar->obj = NULL;
    }
    Py_INCREF(Py_None);
    py_retval = Py_None;
    Py_DECREF(wards);
    return py_retval;
}


PyObject *
_wrap_foo4store_some_object(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PySomeObject *obj;
    SomeObject *obj_ptr;
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    const char *keywords[] = {"obj", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PySomeObject_Type, &obj)) {
        return NULL;
    }
    obj_ptr = (obj ? obj->obj : NULL);
    store_some_object(obj_ptr);
    if (obj) {
        wrapper_lookup_iter = PySomeObject_wrapper_registry.find((void *) obj->obj);
        if (wrapper_lookup_iter != PySomeObject_wrapper_registry.end()) {
            PySomeObject_wrapper_registry.erase(wrapper_lookup_iter);
        }
    
        obj->obj = NULL;
    }
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_foo4print_something_else(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    char const *message2;
    const char *keywords[] = {"message2", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s", (char **) keywords, &message2)) {
        return NULL;
    }
    retval = print_something_else(message2);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_foo4make_interface_id()
{
    PyObject *py_retval;
    PyInterfaceId *py_InterfaceId;
    
    InterfaceId retval = make_interface_id();
    py_InterfaceId = PyObject_New(PyInterfaceId, &PyInterfaceId_Type);
    py_InterfaceId->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_InterfaceId->obj = new InterfaceId(retval);
    PyInterfaceId_wrapper_registry[(void *) py_InterfaceId->obj] = (PyObject *) py_InterfaceId;
    py_retval = Py_BuildValue((char *) "N", py_InterfaceId);
    return py_retval;
}


PyObject *
_wrap_foo4set_simple_list(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    SimpleStructList list_value;
    const char *keywords[] = {"list", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O&", (char **) keywords, _wrap_convert_py2c__SimpleStructList, &list_value)) {
        return NULL;
    }
    retval = set_simple_list(list_value);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_foo4set_foobar_with_return_as_custodian(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    SomeObject *retval;
    PyFoobar *foobar;
    Foobar *foobar_ptr;
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    const char *keywords[] = {"foobar", NULL};
    PySomeObject *py_SomeObject;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter2;
    PyObject *wards;
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyFoobar_Type, &foobar)) {
        return NULL;
    }
    foobar_ptr = (foobar ? foobar->obj : NULL);
    retval = set_foobar_with_return_as_custodian(foobar_ptr);
    if (foobar) {
        wrapper_lookup_iter = PyFoobar_wrapper_registry.find((void *) foobar->obj);
        if (wrapper_lookup_iter != PyFoobar_wrapper_registry.end()) {
            PyFoobar_wrapper_registry.erase(wrapper_lookup_iter);
        }
    
        foobar->obj = NULL;
    }
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    if (typeid((*retval)) == typeid(PySomeObject__PythonHelper))
    {
        py_SomeObject = reinterpret_cast< PySomeObject* >(reinterpret_cast< PySomeObject__PythonHelper* >(retval)->m_pyself);
        py_SomeObject->obj = retval;
        Py_INCREF(py_SomeObject);
    } else {
        wrapper_lookup_iter2 = PySomeObject_wrapper_registry.find((void *) retval);
        if (wrapper_lookup_iter2 == PySomeObject_wrapper_registry.end()) {
            py_SomeObject = NULL;
        } else {
            py_SomeObject = (PySomeObject *) wrapper_lookup_iter2->second;
            Py_INCREF(py_SomeObject);
        }
    
        if (py_SomeObject == NULL) {
            py_SomeObject = PyObject_GC_New(PySomeObject, &PySomeObject_Type);
            py_SomeObject->inst_dict = NULL;
            py_SomeObject->obj = retval;
            py_SomeObject->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
            PySomeObject_wrapper_registry[(void *) py_SomeObject->obj] = (PyObject *) py_SomeObject;
        }
    }
    wards = PyObject_GetAttrString(((PyObject *) py_SomeObject), (char *) "__wards__");
    if (wards == NULL) {
        PyErr_Clear();
        wards = PyList_New(0);
        PyObject_SetAttrString(((PyObject *) py_SomeObject), (char *) "__wards__", wards);
    }
    if (((PyObject *) foobar) && !PySequence_Contains(wards, ((PyObject *) foobar)))
        PyList_Append(wards, ((PyObject *) foobar));
    py_retval = Py_BuildValue((char *) "N", py_SomeObject);
    Py_DECREF(wards);
    return py_retval;
}


PyObject *
_wrap_foo4TypeNameGet__lt__int__gt__()
{
    PyObject *py_retval;
    std::string retval;
    
    retval = TypeNameGet< int >();
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


PyObject *
_wrap_foo4store_zbr(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyZbr *zbr;
    Zbr *zbr_ptr;
    const char *keywords[] = {"zbr", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyZbr_Type, &zbr)) {
        return NULL;
    }
    zbr_ptr = (zbr ? zbr->obj : NULL);
    if (zbr) {
        zbr->obj->Ref();
    }
    store_zbr(zbr_ptr);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_foo4matrix_sum_of_elements(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    float retval;
    float  matrix[6];
    PyObject *py_list;
    int idx;
    PyObject *element;
    const char *keywords[] = {"matrix", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyList_Type, &py_list)) {
        return NULL;
    }
    if (PyList_Size(py_list) != 6) {
        PyErr_SetString(PyExc_TypeError, "Parameter `matrix' must be a list of 6 floats");
        return NULL;
    }
    for (idx = 0; idx < 6; idx++) {
        element = PyList_GET_ITEM(py_list, idx);
        if (!PyFloat_Check(element)) {
            PyErr_SetString(PyExc_TypeError, "Parameter `matrix' must be a list of 6 floats");
            return NULL;
        }
        matrix[idx] = (float) PyFloat_AsDouble(element);
    }
    retval = matrix_sum_of_elements(matrix);
    py_retval = Py_BuildValue((char *) "f", retval);
    return py_retval;
}


PyObject *
_wrap_foo4matrix_identity_new()
{
    PyObject *py_retval;
    float  matrix[6];
    PyObject *py_list;
    int idx;
    
    matrix_identity_new(matrix);
    py_list = PyList_New(6);
    for (idx = 0; idx < 6; idx++) {
        PyList_SET_ITEM(py_list, idx, PyFloat_FromDouble(matrix[idx]));
    }
    py_retval = Py_BuildValue((char *) "N", py_list);
    return py_retval;
}


std::map<void*, PyObject*> PyMIRoot_wrapper_registry;


static int
_wrap_PyMIRoot__tp_init__0(PyMIRoot *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyMIRoot *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyMIRoot_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new MIRoot(*((PyMIRoot *) arg0)->obj);
    return 0;
}

static int
_wrap_PyMIRoot__tp_init__1(PyMIRoot *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new MIRoot();
    return 0;
}

int _wrap_PyMIRoot__tp_init(PyMIRoot *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyMIRoot__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyMIRoot__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyMIRoot_root_method(PyMIRoot *self)
{
    PyObject *py_retval;
    int retval;
    
    retval = self->obj->root_method();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


static PyObject*
_wrap_PyMIRoot__copy__(PyMIRoot *self)
{

    PyMIRoot *py_copy;
    py_copy = PyObject_New(PyMIRoot, &PyMIRoot_Type);
    py_copy->obj = new MIRoot(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyMIRoot_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyMIRoot_methods[] = {
    {(char *) "root_method", (PyCFunction) _wrap_PyMIRoot_root_method, METH_NOARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyMIRoot__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyMIRoot__tp_dealloc(PyMIRoot *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyMIRoot_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyMIRoot_wrapper_registry.end()) {
        PyMIRoot_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        MIRoot *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyMIRoot__tp_richcompare (PyMIRoot *PYBINDGEN_UNUSED(self), PyMIRoot *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyMIRoot_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyMIRoot_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.MIRoot",            /* tp_name */
    sizeof(PyMIRoot),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyMIRoot__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyMIRoot__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyMIRoot_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyMIRoot__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyManipulatedObject_wrapper_registry;

static int
_wrap_PyManipulatedObject__tp_init(PyManipulatedObject *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new ManipulatedObject();
    return 0;
}


PyObject *
_wrap_PyManipulatedObject_SetValue(PyManipulatedObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int value;
    const char *keywords[] = {"value", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &value)) {
        return NULL;
    }
    self->obj->SetValue(value);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PyManipulatedObject_GetValue(PyManipulatedObject *self)
{
    PyObject *py_retval;
    int retval;
    
    retval = self->obj->GetValue();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

static PyMethodDef PyManipulatedObject_methods[] = {
    {(char *) "SetValue", (PyCFunction) _wrap_PyManipulatedObject_SetValue, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "GetValue", (PyCFunction) _wrap_PyManipulatedObject_GetValue, METH_NOARGS, NULL },
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyManipulatedObject__tp_dealloc(PyManipulatedObject *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyManipulatedObject_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyManipulatedObject_wrapper_registry.end()) {
        PyManipulatedObject_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        ManipulatedObject *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyManipulatedObject__tp_richcompare (PyManipulatedObject *PYBINDGEN_UNUSED(self), PyManipulatedObject *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyManipulatedObject_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyManipulatedObject_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.ManipulatedObject",            /* tp_name */
    sizeof(PyManipulatedObject),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyManipulatedObject__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyManipulatedObject__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyManipulatedObject_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyManipulatedObject__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyMapLike_wrapper_registry;


static int
_wrap_PyMapLike__tp_init__0(PyMapLike *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyMapLike *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyMapLike_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new MapLike(*((PyMapLike *) arg0)->obj);
    return 0;
}

static int
_wrap_PyMapLike__tp_init__1(PyMapLike *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new MapLike();
    return 0;
}

int _wrap_PyMapLike__tp_init(PyMapLike *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyMapLike__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyMapLike__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyMapLike_set(PyMapLike *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int key;
    double value;
    const char *keywords[] = {"key", "value", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "id", (char **) keywords, &key, &value)) {
        return NULL;
    }
    self->obj->set(key, value);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


static PyObject*
_wrap_PyMapLike__copy__(PyMapLike *self)
{

    PyMapLike *py_copy;
    py_copy = PyObject_New(PyMapLike, &PyMapLike_Type);
    py_copy->obj = new MapLike(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyMapLike_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyMapLike_methods[] = {
    {(char *) "set", (PyCFunction) _wrap_PyMapLike_set, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyMapLike__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyMapLike__tp_dealloc(PyMapLike *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyMapLike_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyMapLike_wrapper_registry.end()) {
        PyMapLike_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        MapLike *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyMapLike__tp_richcompare (PyMapLike *PYBINDGEN_UNUSED(self), PyMapLike *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyMapLike_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}


static void
PyMapLike_Iter__tp_clear(PyMapLike_Iter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

}


static int
PyMapLike_Iter__tp_traverse(PyMapLike_Iter *self, visitproc visit, void *arg)
{
    Py_VISIT((PyObject *) self->container);
    return 0;
}


static void
_wrap_PyMapLike_Iter__tp_dealloc(PyMapLike_Iter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

    self->ob_type->tp_free((PyObject*)self);
}


static PyObject*
_wrap_PyMapLike__tp_iter(PyMapLike *self)
{
    PyMapLike_Iter *iter = PyObject_GC_New(PyMapLike_Iter, &PyMapLike_IterType);
    Py_INCREF(self);
    iter->container = self;
    iter->iterator = new MapLike::Iterator(self->obj->Begin());
    return (PyObject*) iter;
}


static PyObject*
_wrap_PyMapLike_Iter__tp_iter(PyMapLike_Iter *self)
{
    Py_INCREF(self);
    return (PyObject*) self;
}

static PyObject* _wrap_PyMapLike_Iter__tp_iternext(PyMapLike_Iter *self)
{
    PyObject *py_retval;
    MapLike::Iterator iter;
    
    iter = *self->iterator;
    if (iter == self->container->obj->End()) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    ++(*self->iterator);
    py_retval = Py_BuildValue((char *) "id", iter->first, iter->second);
    return py_retval;
}
PyTypeObject PyMapLike_IterType = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.MapLikeIter",            /* tp_name */
    sizeof(PyMapLike_Iter),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyMapLike_Iter__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PyMapLike_Iter__tp_traverse,     /* tp_traverse */
    (inquiry)PyMapLike_Iter__tp_clear,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_PyMapLike_Iter__tp_iter,          /* tp_iter */
    (iternextfunc)_wrap_PyMapLike_Iter__tp_iternext,     /* tp_iternext */
    (struct PyMethodDef*)NULL, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    NULL,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)NULL,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};

PyTypeObject PyMapLike_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.MapLike",            /* tp_name */
    sizeof(PyMapLike),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyMapLike__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyMapLike__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_PyMapLike__tp_iter,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyMapLike_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyMapLike__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyPointerHolder__Zbr_wrapper_registry;


static int
_wrap_PyPointerHolder__Zbr__tp_init__0(PyPointerHolder__Zbr *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new PointerHolder< Zbr >();
    return 0;
}

static int
_wrap_PyPointerHolder__Zbr__tp_init__1(PyPointerHolder__Zbr *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyPointerHolder__Zbr *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyPointerHolder__Zbr_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new PointerHolder< Zbr >(*((PyPointerHolder__Zbr *) arg0)->obj);
    return 0;
}

int _wrap_PyPointerHolder__Zbr__tp_init(PyPointerHolder__Zbr *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyPointerHolder__Zbr__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyPointerHolder__Zbr__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


static PyObject*
_wrap_PyPointerHolder__Zbr__copy__(PyPointerHolder__Zbr *self)
{

    PyPointerHolder__Zbr *py_copy;
    py_copy = PyObject_New(PyPointerHolder__Zbr, &PyPointerHolder__Zbr_Type);
    py_copy->obj = new PointerHolder< Zbr >(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyPointerHolder__Zbr_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyPointerHolder__Zbr_methods[] = {
    {(char *) "__copy__", (PyCFunction) _wrap_PyPointerHolder__Zbr__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyPointerHolder__Zbr__tp_dealloc(PyPointerHolder__Zbr *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyPointerHolder__Zbr_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyPointerHolder__Zbr_wrapper_registry.end()) {
        PyPointerHolder__Zbr_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        PointerHolder< Zbr > *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyPointerHolder__Zbr__tp_richcompare (PyPointerHolder__Zbr *PYBINDGEN_UNUSED(self), PyPointerHolder__Zbr *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyPointerHolder__Zbr_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyPointerHolder__Zbr_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.PointerHolder__Zbr",            /* tp_name */
    sizeof(PyPointerHolder__Zbr),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyPointerHolder__Zbr__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyPointerHolder__Zbr__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyPointerHolder__Zbr_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyPointerHolder__Zbr__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyProtectedConstructor_wrapper_registry;


static int
_wrap_PyProtectedConstructor__tp_init__0(PyProtectedConstructor *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new ProtectedConstructor();
    return 0;
}


int _wrap_PyProtectedConstructor__tp_init(PyProtectedConstructor *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[1] = {0,};
    retval = _wrap_PyProtectedConstructor__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    error_list = PyList_New(1);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}

static PyMethodDef PyProtectedConstructor_methods[] = {
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyProtectedConstructor__tp_dealloc(PyProtectedConstructor *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyProtectedConstructor_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyProtectedConstructor_wrapper_registry.end()) {
        PyProtectedConstructor_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        ProtectedConstructor *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyProtectedConstructor__tp_richcompare (PyProtectedConstructor *PYBINDGEN_UNUSED(self), PyProtectedConstructor *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyProtectedConstructor_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyProtectedConstructor_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.ProtectedConstructor",            /* tp_name */
    sizeof(PyProtectedConstructor),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyProtectedConstructor__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyProtectedConstructor__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyProtectedConstructor_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyProtectedConstructor__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyReferenceManipulator_wrapper_registry;

void
PyReferenceManipulator__PythonHelper::do_manipulate_object(ManipulatedObject & obj)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    ReferenceManipulator *self_obj_before;
    PyObject *py_retval;
    PyManipulatedObject *py_ManipulatedObject;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "do_manipulate_object"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
        return;
    }
    self_obj_before = reinterpret_cast< PyReferenceManipulator* >(m_pyself)->obj;
    reinterpret_cast< PyReferenceManipulator* >(m_pyself)->obj = (ReferenceManipulator*) this;
    py_ManipulatedObject = PyObject_New(PyManipulatedObject, &PyManipulatedObject_Type);
    py_ManipulatedObject->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_ManipulatedObject->obj = &(obj);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "do_manipulate_object", (char *) "O", py_ManipulatedObject);
    if (py_retval == NULL) {
        PyErr_Print();
        Py_DECREF(py_ManipulatedObject);
        reinterpret_cast< PyReferenceManipulator* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return;
    }
    if (py_retval != Py_None) {
        PyErr_SetString(PyExc_TypeError, "function/method should return None");
        Py_DECREF(py_retval);
        Py_DECREF(py_ManipulatedObject);
        reinterpret_cast< PyReferenceManipulator* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return;
    }
    py_ManipulatedObject->obj = NULL;
    Py_DECREF(py_retval);
    Py_DECREF(py_ManipulatedObject);
    reinterpret_cast< PyReferenceManipulator* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return;
}

static int
_wrap_PyReferenceManipulator__tp_init(PyReferenceManipulator *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    if (self->ob_type != &PyReferenceManipulator_Type)
    {
        self->obj = new PyReferenceManipulator__PythonHelper();
        ((PyReferenceManipulator__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        PyErr_SetString(PyExc_TypeError, "class 'ReferenceManipulator' cannot be constructed");
        return -1;
    }
    return 0;
}


PyObject *
_wrap_PyReferenceManipulator_do_manipulate_object(PyReferenceManipulator *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyManipulatedObject *obj;
    const char *keywords[] = {"obj", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyManipulatedObject_Type, &obj)) {
        return NULL;
    }
    self->obj->do_manipulate_object(*obj->obj);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PyReferenceManipulator_manipulate_object(PyReferenceManipulator *self)
{
    PyObject *py_retval;
    int retval;
    
    retval = self->obj->manipulate_object();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

static PyMethodDef PyReferenceManipulator_methods[] = {
    {(char *) "do_manipulate_object", (PyCFunction) _wrap_PyReferenceManipulator_do_manipulate_object, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "manipulate_object", (PyCFunction) _wrap_PyReferenceManipulator_manipulate_object, METH_NOARGS, NULL },
    {NULL, NULL, 0, NULL}
};

static void
PyReferenceManipulator__tp_clear(PyReferenceManipulator *self)
{
    Py_CLEAR(self->inst_dict);
        ReferenceManipulator *tmp = self->obj;
    self->obj = NULL;
    if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
        delete tmp;
    }
}


static int
PyReferenceManipulator__tp_traverse(PyReferenceManipulator *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);
    
    if (self->obj && typeid(*self->obj) == typeid(PyReferenceManipulator__PythonHelper) )
        Py_VISIT((PyObject *) self);

    return 0;
}


static void
_wrap_PyReferenceManipulator__tp_dealloc(PyReferenceManipulator *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyReferenceManipulator_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyReferenceManipulator_wrapper_registry.end()) {
        PyReferenceManipulator_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
    PyReferenceManipulator__tp_clear(self);
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyReferenceManipulator__tp_richcompare (PyReferenceManipulator *PYBINDGEN_UNUSED(self), PyReferenceManipulator *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyReferenceManipulator_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyReferenceManipulator_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.ReferenceManipulator",            /* tp_name */
    sizeof(PyReferenceManipulator),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyReferenceManipulator__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PyReferenceManipulator__tp_traverse,     /* tp_traverse */
    (inquiry)PyReferenceManipulator__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PyReferenceManipulator__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyReferenceManipulator_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    offsetof(PyReferenceManipulator, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PyReferenceManipulator__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PySingletonClass_wrapper_registry;

static int
_wrap_PySingletonClass__tp_init(PySingletonClass *self, PyObject *args, PyObject *kwargs)
{
    PySingletonClass *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PySingletonClass_Type, &arg0)) {
        return -1;
    }
    self->obj = new SingletonClass(*((PySingletonClass *) arg0)->obj);
    return 0;
}


PyObject *
_wrap_PySingletonClass_GetInstance(void)
{
    PyObject *py_retval;
    SingletonClass *retval;
    PySingletonClass *py_SingletonClass;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    
    retval = SingletonClass::GetInstance();
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    wrapper_lookup_iter = PySingletonClass_wrapper_registry.find((void *) retval);
    if (wrapper_lookup_iter == PySingletonClass_wrapper_registry.end()) {
        py_SingletonClass = NULL;
    } else {
        py_SingletonClass = (PySingletonClass *) wrapper_lookup_iter->second;
        Py_INCREF(py_SingletonClass);
    }
    
    if (py_SingletonClass == NULL) {
        py_SingletonClass = PyObject_New(PySingletonClass, &PySingletonClass_Type);
        py_SingletonClass->obj = retval;
        py_SingletonClass->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
        PySingletonClass_wrapper_registry[(void *) py_SingletonClass->obj] = (PyObject *) py_SingletonClass;
    }
    py_retval = Py_BuildValue((char *) "N", py_SingletonClass);
    return py_retval;
}


static PyObject*
_wrap_PySingletonClass__copy__(PySingletonClass *self)
{

    PySingletonClass *py_copy;
    py_copy = PyObject_New(PySingletonClass, &PySingletonClass_Type);
    py_copy->obj = new SingletonClass(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PySingletonClass_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PySingletonClass_methods[] = {
    {(char *) "GetInstance", (PyCFunction) _wrap_PySingletonClass_GetInstance, METH_NOARGS|METH_STATIC, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PySingletonClass__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PySingletonClass__tp_dealloc(PySingletonClass *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PySingletonClass_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PySingletonClass_wrapper_registry.end()) {
        PySingletonClass_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
    
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PySingletonClass__tp_richcompare (PySingletonClass *PYBINDGEN_UNUSED(self), PySingletonClass *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PySingletonClass_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PySingletonClass_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.SingletonClass",            /* tp_name */
    sizeof(PySingletonClass),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySingletonClass__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PySingletonClass__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PySingletonClass_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PySingletonClass__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PySocket_wrapper_registry;

int
PySocket__PythonHelper::Bind()
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    Socket *self_obj_before;
    PyObject *py_retval;
    int retval;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "Bind"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Socket::Bind();
    }
    self_obj_before = reinterpret_cast< PySocket* >(m_pyself)->obj;
    reinterpret_cast< PySocket* >(m_pyself)->obj = (Socket*) this;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "Bind", (char *) "");
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PySocket* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Socket::Bind();
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PySocket* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Socket::Bind();
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PySocket* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

int
PySocket__PythonHelper::Bind(int address)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    Socket *self_obj_before;
    PyObject *py_retval;
    int retval;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "Bind"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Socket::Bind(address);
    }
    self_obj_before = reinterpret_cast< PySocket* >(m_pyself)->obj;
    reinterpret_cast< PySocket* >(m_pyself)->obj = (Socket*) this;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "Bind", (char *) "i", address);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PySocket* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Socket::Bind(address);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PySocket* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Socket::Bind(address);
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PySocket* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}


static int
_wrap_PySocket__tp_init__0(PySocket *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PySocket_Type)
    {
        self->obj = new PySocket__PythonHelper();
        ((PySocket__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new Socket();
    }
    return 0;
}

static int
_wrap_PySocket__tp_init__1(PySocket *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PySocket *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PySocket_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PySocket_Type)
    {
        self->obj = new PySocket__PythonHelper(*((PySocket *) arg0)->obj);
        ((PySocket__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new Socket(*((PySocket *) arg0)->obj);
    }
    return 0;
}

int _wrap_PySocket__tp_init(PySocket *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PySocket__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PySocket__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}



PyObject *
_wrap_PySocket_Bind__0(PySocket *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    int retval;
    PySocket__PythonHelper *helper_class = dynamic_cast<PySocket__PythonHelper*> (self->obj);
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->Bind()) : (self->obj->Socket::Bind());
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

PyObject *
_wrap_PySocket_Bind__1(PySocket *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    int retval;
    int address;
    PySocket__PythonHelper *helper_class = dynamic_cast<PySocket__PythonHelper*> (self->obj);
    const char *keywords[] = {"address", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &address)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->Bind(address)) : (self->obj->Socket::Bind(address));
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

PyObject * _wrap_PySocket_Bind(PySocket *self, PyObject *args, PyObject *kwargs)
{
    PyObject * retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PySocket_Bind__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PySocket_Bind__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return NULL;
}


static PyObject*
_wrap_PySocket__copy__(PySocket *self)
{

    PySocket *py_copy;
    py_copy = PyObject_GC_New(PySocket, &PySocket_Type);
    py_copy->obj = new Socket(*self->obj);
    py_copy->inst_dict = NULL;
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PySocket_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PySocket_methods[] = {
    {(char *) "Bind", (PyCFunction) _wrap_PySocket_Bind, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PySocket__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
PySocket__tp_clear(PySocket *self)
{
    Py_CLEAR(self->inst_dict);
        Socket *tmp = self->obj;
    self->obj = NULL;
    if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
        delete tmp;
    }
}


static int
PySocket__tp_traverse(PySocket *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);
    
    if (self->obj && typeid(*self->obj) == typeid(PySocket__PythonHelper) )
        Py_VISIT((PyObject *) self);

    return 0;
}


static void
_wrap_PySocket__tp_dealloc(PySocket *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PySocket_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PySocket_wrapper_registry.end()) {
        PySocket_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
    PySocket__tp_clear(self);
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PySocket__tp_richcompare (PySocket *PYBINDGEN_UNUSED(self), PySocket *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PySocket_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PySocket_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.Socket",            /* tp_name */
    sizeof(PySocket),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySocket__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PySocket__tp_traverse,     /* tp_traverse */
    (inquiry)PySocket__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PySocket__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PySocket_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    offsetof(PySocket, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PySocket__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PySomeObject_wrapper_registry;

PyObject *
PySomeObject__PythonHelper::_wrap_protected_method_that_is_not_virtual(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    std::string retval;
    const char *arg;
    Py_ssize_t arg_len;
    PySomeObject__PythonHelper *helper = dynamic_cast< PySomeObject__PythonHelper* >(self->obj);
    const char *keywords[] = {"arg", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &arg, &arg_len)) {
        return NULL;
    }
    if (helper == NULL) {
        PyErr_SetString(PyExc_TypeError, "Method protected_method_that_is_not_virtual of class SomeObject is protected and can only be called by a subclass");
        return NULL;
    }
    retval = helper->protected_method_that_is_not_virtual__parent_caller(std::string(arg, arg_len));
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}

std::string
PySomeObject__PythonHelper::get_prefix() const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    SomeObject *self_obj_before;
    PyObject *py_retval;
    std::string retval;
    const char *retval_ptr;
    Py_ssize_t retval_len;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_prefix"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix();
    }
    self_obj_before = reinterpret_cast< PySomeObject* >(m_pyself)->obj;
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = const_cast< SomeObject* >((const SomeObject*) this);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_prefix", (char *) "");
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix();
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "s#", &retval_ptr, &retval_len)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix();
    }
    retval = std::string(retval_ptr, retval_len);
    Py_DECREF(py_retval);
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

std::string
PySomeObject__PythonHelper::get_prefix_with_foo_ptr(Foo const *foo) const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    SomeObject *self_obj_before;
    PyObject *py_retval;
    std::string retval;
    PyFoo *py_Foo;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    const char *retval_ptr;
    Py_ssize_t retval_len;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_prefix_with_foo_ptr"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix_with_foo_ptr(foo);
    }
    self_obj_before = reinterpret_cast< PySomeObject* >(m_pyself)->obj;
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = const_cast< SomeObject* >((const SomeObject*) this);
    wrapper_lookup_iter = PyFoo_wrapper_registry.find((void *) foo);
    if (wrapper_lookup_iter == PyFoo_wrapper_registry.end()) {
        py_Foo = NULL;
    } else {
        py_Foo = (PyFoo *) wrapper_lookup_iter->second;
        Py_INCREF(py_Foo);
    }
    
    if (py_Foo == NULL)
    {
        py_Foo = PyObject_New(PyFoo, &PyFoo_Type);
        py_Foo->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
        py_Foo->obj = new Foo(*foo);
        py_Foo->obj->initialize();
        PyFoo_wrapper_registry[(void *) py_Foo->obj] = (PyObject *) py_Foo;
    }
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_prefix_with_foo_ptr", (char *) "N", py_Foo);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix_with_foo_ptr(foo);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "s#", &retval_ptr, &retval_len)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix_with_foo_ptr(foo);
    }
    retval = std::string(retval_ptr, retval_len);
    Py_DECREF(py_retval);
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

std::string
PySomeObject__PythonHelper::get_prefix_with_foo_ref(Foo const & foo) const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    SomeObject *self_obj_before;
    PyObject *py_retval;
    std::string retval;
    PyFoo *py_Foo;
    const char *retval_ptr;
    Py_ssize_t retval_len;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_prefix_with_foo_ref"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix_with_foo_ref(foo);
    }
    self_obj_before = reinterpret_cast< PySomeObject* >(m_pyself)->obj;
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = const_cast< SomeObject* >((const SomeObject*) this);
    py_Foo = PyObject_New(PyFoo, &PyFoo_Type);
    py_Foo->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_Foo->obj = (Foo*) (&(foo));
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_prefix_with_foo_ref", (char *) "O", py_Foo);
    if (py_retval == NULL) {
        PyErr_Print();
        Py_DECREF(py_Foo);
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix_with_foo_ref(foo);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "s#", &retval_ptr, &retval_len)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        Py_DECREF(py_Foo);
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix_with_foo_ref(foo);
    }
    if (py_Foo->ob_refcnt == 1)
        py_Foo->obj = NULL;
    else{
    
        py_Foo->obj = new Foo(foo);
        py_Foo->obj->initialize();
        PyFoo_wrapper_registry[(void *) py_Foo->obj] = (PyObject *) py_Foo;
    }
    retval = std::string(retval_ptr, retval_len);
    Py_DECREF(py_retval);
    Py_DECREF(py_Foo);
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

std::string
PySomeObject__PythonHelper::get_prefix_with_foo_value(Foo foo) const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    SomeObject *self_obj_before;
    PyObject *py_retval;
    std::string retval;
    PyFoo *py_Foo;
    const char *retval_ptr;
    Py_ssize_t retval_len;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_prefix_with_foo_value"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix_with_foo_value(foo);
    }
    self_obj_before = reinterpret_cast< PySomeObject* >(m_pyself)->obj;
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = const_cast< SomeObject* >((const SomeObject*) this);
    py_Foo = PyObject_New(PyFoo, &PyFoo_Type);
    py_Foo->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_Foo->obj = new Foo(foo);
    py_Foo->obj->initialize();
    PyFoo_wrapper_registry[(void *) py_Foo->obj] = (PyObject *) py_Foo;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_prefix_with_foo_value", (char *) "N", py_Foo);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix_with_foo_value(foo);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "s#", &retval_ptr, &retval_len)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_prefix_with_foo_value(foo);
    }
    retval = std::string(retval_ptr, retval_len);
    Py_DECREF(py_retval);
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

PyObject *
PySomeObject__PythonHelper::get_pyobject()
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    SomeObject *self_obj_before;
    PyObject *py_retval;
    PyObject *retval;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_pyobject"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_pyobject();
    }
    self_obj_before = reinterpret_cast< PySomeObject* >(m_pyself)->obj;
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = (SomeObject*) this;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_pyobject", (char *) "");
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_pyobject();
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "O", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_pyobject();
    }
    Py_INCREF((PyObject*) retval);
    Py_DECREF(py_retval);
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

std::string
PySomeObject__PythonHelper::get_something() const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    SomeObject *self_obj_before;
    PyObject *py_retval;
    std::string retval;
    const char *retval_ptr;
    Py_ssize_t retval_len;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_something"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_something();
    }
    self_obj_before = reinterpret_cast< PySomeObject* >(m_pyself)->obj;
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = const_cast< SomeObject* >((const SomeObject*) this);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_something", (char *) "");
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_something();
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "s#", &retval_ptr, &retval_len)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_something();
    }
    retval = std::string(retval_ptr, retval_len);
    Py_DECREF(py_retval);
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

std::string
PySomeObject__PythonHelper::get_something(int x) const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    SomeObject *self_obj_before;
    PyObject *py_retval;
    std::string retval;
    const char *retval_ptr;
    Py_ssize_t retval_len;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_something"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_something(x);
    }
    self_obj_before = reinterpret_cast< PySomeObject* >(m_pyself)->obj;
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = const_cast< SomeObject* >((const SomeObject*) this);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_something", (char *) "i", x);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_something(x);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "s#", &retval_ptr, &retval_len)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return SomeObject::get_something(x);
    }
    retval = std::string(retval_ptr, retval_len);
    Py_DECREF(py_retval);
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

void
PySomeObject__PythonHelper::set_pyobject(PyObject *pyobject)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    SomeObject *self_obj_before;
    PyObject *py_retval;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "set_pyobject"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        SomeObject::set_pyobject(pyobject);
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
        return;
    }
    self_obj_before = reinterpret_cast< PySomeObject* >(m_pyself)->obj;
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = (SomeObject*) this;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "set_pyobject", (char *) "O", pyobject);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return;
    }
    if (py_retval != Py_None) {
        PyErr_SetString(PyExc_TypeError, "function/method should return None");
        Py_DECREF(py_retval);
        reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return;
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PySomeObject* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return;
}
static PyObject* _wrap_PySomeObject__get_m_prefix(PySomeObject *self, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "s#", (self->obj->m_prefix).c_str(), (self->obj->m_prefix).size());
    return py_retval;
}
static int _wrap_PySomeObject__set_m_prefix(PySomeObject *self, PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    const char *retval_ptr;
    Py_ssize_t retval_len;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "s#", &retval_ptr, &retval_len)) {
        Py_DECREF(py_retval);
        return -1;
    }
    self->obj->m_prefix = std::string(retval_ptr, retval_len);
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef PySomeObject__getsets[] = {
    {
        (char*) "m_prefix", /* attribute name */
        (getter) _wrap_PySomeObject__get_m_prefix, /* C function to get the attribute */
        (setter) _wrap_PySomeObject__set_m_prefix, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    { NULL, NULL, NULL, NULL, NULL }
};
static PyObject* _wrap_PySomeObject__get_instance_count(PyObject * PYBINDGEN_UNUSED(obj), void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "i", SomeObject::instance_count);
    return py_retval;
}
static int _wrap_PySomeObject__set_instance_count(PySomeObject * PYBINDGEN_UNUSED(dummy), PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &SomeObject::instance_count)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Py_DECREF(py_retval);
    return 0;
}
static PyObject* _wrap_PySomeObject__get_staticData(PyObject * PYBINDGEN_UNUSED(obj), void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "s#", (SomeObject::staticData).c_str(), (SomeObject::staticData).size());
    return py_retval;
}
static int _wrap_PySomeObject__set_staticData(PySomeObject * PYBINDGEN_UNUSED(dummy), PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    const char *retval_ptr;
    Py_ssize_t retval_len;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "s#", &retval_ptr, &retval_len)) {
        Py_DECREF(py_retval);
        return -1;
    }
    SomeObject::staticData = std::string(retval_ptr, retval_len);
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef SomeObjectMeta__getsets[] = {
    {
        (char*) "staticData", /* attribute name */
        (getter) _wrap_PySomeObject__get_staticData, /* C function to get the attribute */
        (setter) _wrap_PySomeObject__set_staticData, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    {
        (char*) "instance_count", /* attribute name */
        (getter) _wrap_PySomeObject__get_instance_count, /* C function to get the attribute */
        (setter) _wrap_PySomeObject__set_instance_count, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject PySomeObjectMeta_Type = {
	PyObject_HEAD_INIT(NULL)
	0,					/* ob_size */
	(char *) "SomeObjectMeta",		        /* tp_name */
	0,					/* tp_basicsize */
	0,					/* tp_itemsize */
	0,	 				/* tp_dealloc */
	0,					/* tp_print */
	0,					/* tp_getattr */
	0,					/* tp_setattr */
	0,					/* tp_compare */
	0,					/* tp_repr */
	0,					/* tp_as_number */
	0,					/* tp_as_sequence */
	0,		       			/* tp_as_mapping */
	0,					/* tp_hash */
	0,					/* tp_call */
	0,					/* tp_str */
	0,					/* tp_getattro */
	0,					/* tp_setattro */
	0,					/* tp_as_buffer */
	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_BASETYPE, /* tp_flags */
 	0,					/* tp_doc */
	0,					/* tp_traverse */
 	0,					/* tp_clear */
	0,					/* tp_richcompare */
	0,					/* tp_weaklistoffset */
	0,					/* tp_iter */
	0,					/* tp_iternext */
	0,					/* tp_methods */
	0,					/* tp_members */
	SomeObjectMeta__getsets,				/* tp_getset */
	0,					/* tp_base */
	0,					/* tp_dict */
	0,	                                /* tp_descr_get */
	0,  		                        /* tp_descr_set */
	0,					/* tp_dictoffset */
	0,					/* tp_init */
	0,					/* tp_alloc */
	0,					/* tp_new */
	0,               			/* tp_free */
        0,                                      /* tp_is_gc */
        0,                                      /* tp_bases */
        0,                                      /* tp_mro */
        0,                                      /* tp_cache */
        0,                                      /* tp_subclasses */
        0,                                      /* tp_weaklist */
        0                                       /* tp_del */
};



static int
_wrap_PySomeObject__tp_init__0(PySomeObject *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PySomeObject *other;
    const char *keywords[] = {"other", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PySomeObject_Type, &other)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PySomeObject_Type)
    {
        self->obj = new PySomeObject__PythonHelper(*((PySomeObject *) other)->obj);
        ((PySomeObject__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new SomeObject(*((PySomeObject *) other)->obj);
    }
    return 0;
}

static int
_wrap_PySomeObject__tp_init__1(PySomeObject *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *prefix;
    Py_ssize_t prefix_len;
    const char *keywords[] = {"prefix", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &prefix, &prefix_len)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PySomeObject_Type)
    {
        self->obj = new PySomeObject__PythonHelper(std::string(prefix, prefix_len));
        ((PySomeObject__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new SomeObject(std::string(prefix, prefix_len));
    }
    return 0;
}

static int
_wrap_PySomeObject__tp_init__2(PySomeObject *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    int prefix_len;
    const char *keywords[] = {"prefix_len", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &prefix_len)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PySomeObject_Type)
    {
        self->obj = new PySomeObject__PythonHelper(prefix_len);
        ((PySomeObject__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new SomeObject(prefix_len);
    }
    return 0;
}

int _wrap_PySomeObject__tp_init(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[3] = {0,};
    retval = _wrap_PySomeObject__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PySomeObject__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    retval = _wrap_PySomeObject__tp_init__2(self, args, kwargs, &exceptions[2]);
    if (!exceptions[2]) {
        Py_DECREF(exceptions[0]);
        Py_DECREF(exceptions[1]);
        return retval;
    }
    error_list = PyList_New(3);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyList_SET_ITEM(error_list, 2, PyObject_Str(exceptions[2]));
    Py_DECREF(exceptions[2]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PySomeObject_set_foo_by_ref(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyObject *foo;
    Foo foo2;
    const char *keywords[] = {"foo", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O", (char **) keywords, &foo)) {
        return NULL;
    }
    if (PyObject_IsInstance(foo, (PyObject*) &PyFoo_Type)) {
        foo2 = *((PyFoo *) foo)->obj;
    } else if (PyObject_IsInstance(foo, (PyObject*) &PyZoo_Type)) {
        foo2 = *((PyZoo *) foo)->obj;
    } else {
    
        PyErr_Format(PyExc_TypeError, "parameter must an instance of one of the types (Foo, Zoo), not %s", foo->ob_type->tp_name);
        return NULL;
    }
    self->obj->set_foo_by_ref(foo2);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PySomeObject_call_get_prefix(PySomeObject *self)
{
    PyObject *py_retval;
    std::string retval;
    
    retval = self->obj->call_get_prefix();
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


PyObject *
_wrap_PySomeObject_peek_zbr(PySomeObject *self)
{
    PyObject *py_retval;
    Zbr *retval;
    PyZbr *py_Zbr;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    
    retval = self->obj->peek_zbr();
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    if (typeid((*retval)) == typeid(PyZbr__PythonHelper))
    {
        py_Zbr = reinterpret_cast< PyZbr* >(reinterpret_cast< PyZbr__PythonHelper* >(retval)->m_pyself);
        py_Zbr->obj = retval;
        Py_INCREF(py_Zbr);
    } else {
        wrapper_lookup_iter = PyZbr_wrapper_registry.find((void *) retval);
        if (wrapper_lookup_iter == PyZbr_wrapper_registry.end()) {
            py_Zbr = NULL;
        } else {
            py_Zbr = (PyZbr *) wrapper_lookup_iter->second;
            Py_INCREF(py_Zbr);
        }
    
        if (py_Zbr == NULL) {
            py_Zbr = PyObject_GC_New(PyZbr, &PyZbr_Type);
            py_Zbr->inst_dict = NULL;
            py_Zbr->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
            retval->Ref();
            py_Zbr->obj = retval;
            PyZbr_wrapper_registry[(void *) py_Zbr->obj] = (PyObject *) py_Zbr;
        }
    }
    py_retval = Py_BuildValue((char *) "N", py_Zbr);
    return py_retval;
}


PyObject *
_wrap_PySomeObject_set_foo_ptr(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyFoo *foo;
    Foo *foo_ptr;
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    const char *keywords[] = {"foo", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyFoo_Type, &foo)) {
        return NULL;
    }
    foo_ptr = (foo ? foo->obj : NULL);
    self->obj->set_foo_ptr(foo_ptr);
    if (foo) {
        wrapper_lookup_iter = PyFoo_wrapper_registry.find((void *) foo->obj);
        if (wrapper_lookup_iter != PyFoo_wrapper_registry.end()) {
            PyFoo_wrapper_registry.erase(wrapper_lookup_iter);
        }
    
        foo->obj = NULL;
    }
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_prefix_with_foo_ref(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    std::string retval;
    PyFoo *foo;
    PySomeObject__PythonHelper *helper_class = dynamic_cast<PySomeObject__PythonHelper*> (self->obj);
    const char *keywords[] = {"foo", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyFoo_Type, &foo)) {
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->get_prefix_with_foo_ref(*foo->obj)) : (self->obj->SomeObject::get_prefix_with_foo_ref(*foo->obj));
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


PyObject *
_wrap_foo4some_object_ref_get_something_prefixed(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    std::string retval;
    const char *something;
    Py_ssize_t something_len;
    const char *keywords[] = {"something", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &something, &something_len)) {
        return NULL;
    }
    retval = some_object_ref_get_something_prefixed(*((PySomeObject *) self)->obj, std::string(something, something_len));
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_foo_value(PySomeObject *self)
{
    PyObject *py_retval;
    PyFoo *py_Foo;
    
    Foo retval = self->obj->get_foo_value();
    py_Foo = PyObject_New(PyFoo, &PyFoo_Type);
    py_Foo->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_Foo->obj = new Foo(retval);
    py_Foo->obj->initialize();
    PyFoo_wrapper_registry[(void *) py_Foo->obj] = (PyObject *) py_Foo;
    py_retval = Py_BuildValue((char *) "N", py_Foo);
    return py_retval;
}


PyObject *
_wrap_foo4some_object_get_something_prefixed(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    std::string retval;
    const char *something;
    Py_ssize_t something_len;
    const char *keywords[] = {"something", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &something, &something_len)) {
        return NULL;
    }
    retval = some_object_get_something_prefixed(self->obj, std::string(something, something_len));
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


PyObject *
_wrap_PySomeObject_set_zbr_transfer(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyZbr *zbr;
    Zbr *zbr_ptr;
    const char *keywords[] = {"zbr", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyZbr_Type, &zbr)) {
        return NULL;
    }
    zbr_ptr = (zbr ? zbr->obj : NULL);
    if (zbr) {
        zbr->obj->Ref();
    }
    self->obj->set_zbr_transfer(zbr_ptr);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PySomeObject_add_prefix(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    const char *message;
    Py_ssize_t message_len;
    std::string message_std;
    const char *keywords[] = {"message", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &message, &message_len)) {
        return NULL;
    }
    message_std = std::string(message, message_len);
    retval = self->obj->add_prefix(message_std);
    py_retval = Py_BuildValue((char *) "is#", retval, (message_std).c_str(), (message_std).size());
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_prefix_with_foo_ptr(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    std::string retval;
    PyFoo *foo;
    Foo *foo_ptr;
    PySomeObject__PythonHelper *helper_class = dynamic_cast<PySomeObject__PythonHelper*> (self->obj);
    const char *keywords[] = {"foo", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyFoo_Type, &foo)) {
        return NULL;
    }
    foo_ptr = (foo ? foo->obj : NULL);
    retval = (helper_class == NULL)? (self->obj->get_prefix_with_foo_ptr(foo_ptr)) : (self->obj->SomeObject::get_prefix_with_foo_ptr(foo_ptr));
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_pyobject(PySomeObject *self)
{
    PyObject *py_retval;
    PyObject *retval;
    PySomeObject__PythonHelper *helper_class = dynamic_cast<PySomeObject__PythonHelper*> (self->obj);
    
    retval = (helper_class == NULL)? (self->obj->get_pyobject()) : (self->obj->SomeObject::get_pyobject());
    py_retval = Py_BuildValue((char *) "N", retval);
    return py_retval;
}


PyObject *
_wrap_PySomeObject___call__(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    const char *message;
    Py_ssize_t message_len;
    std::string message_std;
    const char *keywords[] = {"message", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &message, &message_len)) {
        return NULL;
    }
    message_std = std::string(message, message_len);
    retval = self->obj->operator()(message_std);
    py_retval = Py_BuildValue((char *) "is#", retval, (message_std).c_str(), (message_std).size());
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_zbr(PySomeObject *self)
{
    PyObject *py_retval;
    Zbr *retval;
    PyZbr *py_Zbr;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    
    retval = self->obj->get_zbr();
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    if (typeid((*retval)) == typeid(PyZbr__PythonHelper))
    {
        py_Zbr = reinterpret_cast< PyZbr* >(reinterpret_cast< PyZbr__PythonHelper* >(retval)->m_pyself);
        py_Zbr->obj = retval;
        retval->Unref();
        Py_INCREF(py_Zbr);
    } else {
        wrapper_lookup_iter = PyZbr_wrapper_registry.find((void *) retval);
        if (wrapper_lookup_iter == PyZbr_wrapper_registry.end()) {
            py_Zbr = NULL;
        } else {
            py_Zbr = (PyZbr *) wrapper_lookup_iter->second;
            Py_INCREF(py_Zbr);
        }
    
        if (py_Zbr == NULL) {
            py_Zbr = PyObject_GC_New(PyZbr, &PyZbr_Type);
            py_Zbr->inst_dict = NULL;
            py_Zbr->obj = retval;
            py_Zbr->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
            PyZbr_wrapper_registry[(void *) py_Zbr->obj] = (PyObject *) py_Zbr;
        } else {
            retval->Unref();
        }
    }
    py_retval = Py_BuildValue((char *) "N", py_Zbr);
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_zbr_pholder(PySomeObject *self)
{
    PyObject *py_retval;
    PyPointerHolder__Zbr *py_PointerHolder;
    
    PointerHolder< Zbr > retval = self->obj->get_zbr_pholder();
    py_PointerHolder = PyObject_New(PyPointerHolder__Zbr, &PyPointerHolder__Zbr_Type);
    py_PointerHolder->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_PointerHolder->obj = new PointerHolder< Zbr >(retval);
    PyPointerHolder__Zbr_wrapper_registry[(void *) py_PointerHolder->obj] = (PyObject *) py_PointerHolder;
    py_retval = Py_BuildValue((char *) "N", py_PointerHolder);
    return py_retval;
}


PyObject *
_wrap_PySomeObject_set_foo_value(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyObject *foo;
    Foo foo2;
    const char *keywords[] = {"foo", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O", (char **) keywords, &foo)) {
        return NULL;
    }
    if (PyObject_IsInstance(foo, (PyObject*) &PyFoo_Type)) {
        foo2 = *((PyFoo *) foo)->obj;
    } else if (PyObject_IsInstance(foo, (PyObject*) &PyZoo_Type)) {
        foo2 = *((PyZoo *) foo)->obj;
    } else {
    
        PyErr_Format(PyExc_TypeError, "parameter must an instance of one of the types (Foo, Zoo), not %s", foo->ob_type->tp_name);
        return NULL;
    }
    self->obj->set_foo_value(foo2);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_foobar_with_self_as_custodian(PySomeObject *self)
{
    PyObject *py_retval;
    Foobar *retval;
    PyFoobar *py_Foobar;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    PyObject *wards;
    
    retval = self->obj->get_foobar_with_self_as_custodian();
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    wrapper_lookup_iter = PyFoobar_wrapper_registry.find((void *) retval);
    if (wrapper_lookup_iter == PyFoobar_wrapper_registry.end()) {
        py_Foobar = NULL;
    } else {
        py_Foobar = (PyFoobar *) wrapper_lookup_iter->second;
        Py_INCREF(py_Foobar);
    }
    
    if (py_Foobar == NULL) {
        py_Foobar = PyObject_GC_New(PyFoobar, &PyFoobar_Type);
        py_Foobar->inst_dict = NULL;
        py_Foobar->obj = retval;
        py_Foobar->flags = PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED;
        PyFoobar_wrapper_registry[(void *) py_Foobar->obj] = (PyObject *) py_Foobar;
    }
    wards = PyObject_GetAttrString(((PyObject *) self), (char *) "__wards__");
    if (wards == NULL) {
        PyErr_Clear();
        wards = PyList_New(0);
        PyObject_SetAttrString(((PyObject *) self), (char *) "__wards__", wards);
    }
    if (((PyObject *) py_Foobar) && !PySequence_Contains(wards, ((PyObject *) py_Foobar)))
        PyList_Append(wards, ((PyObject *) py_Foobar));
    py_retval = Py_BuildValue((char *) "N", py_Foobar);
    Py_DECREF(wards);
    return py_retval;
}


PyObject *
_wrap_PySomeObject_set_foo_shared_ptr(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyFoo *foo;
    Foo *foo_ptr;
    const char *keywords[] = {"foo", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyFoo_Type, &foo)) {
        return NULL;
    }
    foo_ptr = (foo ? foo->obj : NULL);
    self->obj->set_foo_shared_ptr(foo_ptr);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_internal_zbr(PySomeObject *self)
{
    PyObject *py_retval;
    Zbr *retval;
    PyZbr *py_Zbr;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    
    retval = self->obj->get_internal_zbr();
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    if (typeid((*retval)) == typeid(PyZbr__PythonHelper))
    {
        py_Zbr = reinterpret_cast< PyZbr* >(reinterpret_cast< PyZbr__PythonHelper* >(retval)->m_pyself);
        py_Zbr->obj = retval;
        retval->Unref();
        Py_INCREF(py_Zbr);
    } else {
        wrapper_lookup_iter = PyZbr_wrapper_registry.find((void *) retval);
        if (wrapper_lookup_iter == PyZbr_wrapper_registry.end()) {
            py_Zbr = NULL;
        } else {
            py_Zbr = (PyZbr *) wrapper_lookup_iter->second;
            Py_INCREF(py_Zbr);
        }
    
        if (py_Zbr == NULL) {
            py_Zbr = PyObject_GC_New(PyZbr, &PyZbr_Type);
            py_Zbr->inst_dict = NULL;
            py_Zbr->obj = retval;
            py_Zbr->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
            PyZbr_wrapper_registry[(void *) py_Zbr->obj] = (PyObject *) py_Zbr;
        } else {
            retval->Unref();
        }
    }
    py_retval = Py_BuildValue((char *) "N", py_Zbr);
    return py_retval;
}


PyObject *
_wrap_PySomeObject_set_pyobject(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyObject *pyobject;
    PySomeObject__PythonHelper *helper_class = dynamic_cast<PySomeObject__PythonHelper*> (self->obj);
    const char *keywords[] = {"pyobject", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O", (char **) keywords, &pyobject)) {
        return NULL;
    }
    (helper_class == NULL)? (self->obj->set_pyobject(pyobject)) : (self->obj->SomeObject::set_pyobject(pyobject));
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_foobar_with_other_as_custodian(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    Foobar *retval;
    PySomeObject *other;
    SomeObject *other_ptr;
    const char *keywords[] = {"other", NULL};
    PyFoobar *py_Foobar;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    PyObject *wards;
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PySomeObject_Type, &other)) {
        return NULL;
    }
    other_ptr = (other ? other->obj : NULL);
    retval = self->obj->get_foobar_with_other_as_custodian(other_ptr);
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    wrapper_lookup_iter = PyFoobar_wrapper_registry.find((void *) retval);
    if (wrapper_lookup_iter == PyFoobar_wrapper_registry.end()) {
        py_Foobar = NULL;
    } else {
        py_Foobar = (PyFoobar *) wrapper_lookup_iter->second;
        Py_INCREF(py_Foobar);
    }
    
    if (py_Foobar == NULL) {
        py_Foobar = PyObject_GC_New(PyFoobar, &PyFoobar_Type);
        py_Foobar->inst_dict = NULL;
        py_Foobar->obj = retval;
        py_Foobar->flags = PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED;
        PyFoobar_wrapper_registry[(void *) py_Foobar->obj] = (PyObject *) py_Foobar;
    }
    wards = PyObject_GetAttrString(((PyObject *) other), (char *) "__wards__");
    if (wards == NULL) {
        PyErr_Clear();
        wards = PyList_New(0);
        PyObject_SetAttrString(((PyObject *) other), (char *) "__wards__", wards);
    }
    if (((PyObject *) py_Foobar) && !PySequence_Contains(wards, ((PyObject *) py_Foobar)))
        PyList_Append(wards, ((PyObject *) py_Foobar));
    py_retval = Py_BuildValue((char *) "N", py_Foobar);
    Py_DECREF(wards);
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_foo_by_ref(PySomeObject *self)
{
    PyObject *py_retval;
    PyFoo *foo;
    
    foo = PyObject_New(PyFoo, &PyFoo_Type);
    foo->obj = new Foo();
    foo->obj->initialize();
    PyFoo_wrapper_registry[(void *) foo->obj] = (PyObject *) foo;
    self->obj->get_foo_by_ref(*foo->obj);
    foo->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_retval = Py_BuildValue((char *) "N", foo);
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_prefix_with_foo_value(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    std::string retval;
    PyObject *foo;
    Foo foo2;
    PySomeObject__PythonHelper *helper_class = dynamic_cast<PySomeObject__PythonHelper*> (self->obj);
    const char *keywords[] = {"foo", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O", (char **) keywords, &foo)) {
        return NULL;
    }
    if (PyObject_IsInstance(foo, (PyObject*) &PyFoo_Type)) {
        foo2 = *((PyFoo *) foo)->obj;
    } else if (PyObject_IsInstance(foo, (PyObject*) &PyZoo_Type)) {
        foo2 = *((PyZoo *) foo)->obj;
    } else {
    
        PyErr_Format(PyExc_TypeError, "parameter must an instance of one of the types (Foo, Zoo), not %s", foo->ob_type->tp_name);
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->get_prefix_with_foo_value(foo2)) : (self->obj->SomeObject::get_prefix_with_foo_value(foo2));
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


PyObject *
_wrap_PySomeObject_set_zbr_pholder(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyPointerHolder__Zbr *zbr;
    const char *keywords[] = {"zbr", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyPointerHolder__Zbr_Type, &zbr)) {
        return NULL;
    }
    self->obj->set_zbr_pholder(*((PyPointerHolder__Zbr *) zbr)->obj);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_prefix(PySomeObject *self)
{
    PyObject *py_retval;
    std::string retval;
    PySomeObject__PythonHelper *helper_class = dynamic_cast<PySomeObject__PythonHelper*> (self->obj);
    
    retval = (helper_class == NULL)? (self->obj->get_prefix()) : (self->obj->SomeObject::get_prefix());
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_foo_shared_ptr(PySomeObject *self)
{
    PyObject *py_retval;
    Foo *retval;
    PyFoo *py_Foo;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    
    retval = self->obj->get_foo_shared_ptr();
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    wrapper_lookup_iter = PyFoo_wrapper_registry.find((void *) retval);
    if (wrapper_lookup_iter == PyFoo_wrapper_registry.end()) {
        py_Foo = NULL;
    } else {
        py_Foo = (PyFoo *) wrapper_lookup_iter->second;
        Py_INCREF(py_Foo);
    }
    
    if (py_Foo == NULL) {
        py_Foo = PyObject_New(PyFoo, &PyFoo_Type);
        py_Foo->obj = new Foo((*retval));
        py_Foo->obj->initialize();
        py_Foo->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
        PyFoo_wrapper_registry[(void *) py_Foo->obj] = (PyObject *) py_Foo;
    }
    py_retval = Py_BuildValue((char *) "N", py_Foo);
    return py_retval;
}


PyObject *
_wrap_PySomeObject_get_foo_ptr(PySomeObject *self)
{
    PyObject *py_retval;
    Foo *retval;
    PyFoo *py_Foo;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    PyTypeObject *wrapper_type = 0;
    
    retval = self->obj->get_foo_ptr();
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    wrapper_lookup_iter = PyFoo_wrapper_registry.find((void *) retval);
    if (wrapper_lookup_iter == PyFoo_wrapper_registry.end()) {
        py_Foo = NULL;
    } else {
        py_Foo = (PyFoo *) wrapper_lookup_iter->second;
        Py_INCREF(py_Foo);
    }
    
    if (py_Foo == NULL) {
        wrapper_type = PyFoo__typeid_map.lookup_wrapper(typeid((*retval)), &PyFoo_Type);
        py_Foo = PyObject_New(PyFoo, wrapper_type);
        py_Foo->obj = retval;
        py_Foo->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
        PyFoo_wrapper_registry[(void *) py_Foo->obj] = (PyObject *) py_Foo;
    }
    py_retval = Py_BuildValue((char *) "N", py_Foo);
    return py_retval;
}


PyObject *
_wrap_PySomeObject_set_zbr_shared(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyZbr *zbr;
    Zbr *zbr_ptr;
    const char *keywords[] = {"zbr", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyZbr_Type, &zbr)) {
        return NULL;
    }
    zbr_ptr = (zbr ? zbr->obj : NULL);
    self->obj->set_zbr_shared(zbr_ptr);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}



PyObject *
_wrap_PySomeObject_get_something__0(PySomeObject *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    std::string retval;
    PySomeObject__PythonHelper *helper_class = dynamic_cast<PySomeObject__PythonHelper*> (self->obj);
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->get_something()) : (self->obj->SomeObject::get_something());
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}

PyObject *
_wrap_PySomeObject_get_something__1(PySomeObject *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    std::string retval;
    int x;
    PySomeObject__PythonHelper *helper_class = dynamic_cast<PySomeObject__PythonHelper*> (self->obj);
    const char *keywords[] = {"x", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &x)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->get_something(x)) : (self->obj->SomeObject::get_something(x));
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}

PyObject * _wrap_PySomeObject_get_something(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject * retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PySomeObject_get_something__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PySomeObject_get_something__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return NULL;
}



PyObject *
_wrap_PySomeObject_get_int__0(PySomeObject *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    int retval;
    char const *from_string;
    const char *keywords[] = {"from_string", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s", (char **) keywords, &from_string)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    retval = self->obj->get_int(from_string);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

PyObject *
_wrap_PySomeObject_get_int__1(PySomeObject *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    int retval;
    double from_float;
    const char *keywords[] = {"from_float", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "d", (char **) keywords, &from_float)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    retval = self->obj->get_int(from_float);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

PyObject * _wrap_PySomeObject_get_int(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject * retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PySomeObject_get_int__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PySomeObject_get_int__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return NULL;
}


PyObject *
_wrap_PySomeObject_set_foobar_with_self_as_custodian(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyFoobar *foobar;
    Foobar *foobar_ptr;
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    PyObject *wards;
    const char *keywords[] = {"foobar", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyFoobar_Type, &foobar)) {
        return NULL;
    }
    foobar_ptr = (foobar ? foobar->obj : NULL);
    wards = PyObject_GetAttrString(((PyObject *) self), (char *) "__wards__");
    if (wards == NULL) {
        PyErr_Clear();
        wards = PyList_New(0);
        PyObject_SetAttrString(((PyObject *) self), (char *) "__wards__", wards);
    }
    if (((PyObject *) foobar) && !PySequence_Contains(wards, ((PyObject *) foobar)))
        PyList_Append(wards, ((PyObject *) foobar));
    self->obj->set_foobar_with_self_as_custodian(foobar_ptr);
    if (foobar) {
        wrapper_lookup_iter = PyFoobar_wrapper_registry.find((void *) foobar->obj);
        if (wrapper_lookup_iter != PyFoobar_wrapper_registry.end()) {
            PyFoobar_wrapper_registry.erase(wrapper_lookup_iter);
        }
    
        foobar->obj = NULL;
    }
    Py_INCREF(Py_None);
    py_retval = Py_None;
    Py_DECREF(wards);
    return py_retval;
}


PyObject *
_wrap_foo4some_object_val_get_something_prefixed(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    std::string retval;
    const char *something;
    Py_ssize_t something_len;
    const char *keywords[] = {"something", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &something, &something_len)) {
        return NULL;
    }
    retval = some_object_val_get_something_prefixed(*((PySomeObject *) self)->obj, std::string(something, something_len));
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


static PyObject*
_wrap_PySomeObject__copy__(PySomeObject *self)
{

    PySomeObject *py_copy;
    py_copy = PyObject_GC_New(PySomeObject, &PySomeObject_Type);
    py_copy->obj = new SomeObject(*self->obj);
    py_copy->inst_dict = NULL;
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PySomeObject_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PySomeObject_methods[] = {
    {(char *) "set_foo_by_ref", (PyCFunction) _wrap_PySomeObject_set_foo_by_ref, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "call_get_prefix", (PyCFunction) _wrap_PySomeObject_call_get_prefix, METH_NOARGS, NULL },
    {(char *) "peek_zbr", (PyCFunction) _wrap_PySomeObject_peek_zbr, METH_NOARGS, NULL },
    {(char *) "set_foo_ptr", (PyCFunction) _wrap_PySomeObject_set_foo_ptr, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_prefix_with_foo_ref", (PyCFunction) _wrap_PySomeObject_get_prefix_with_foo_ref, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "ref_get_something_prefixed", (PyCFunction) _wrap_foo4some_object_ref_get_something_prefixed, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_foo_value", (PyCFunction) _wrap_PySomeObject_get_foo_value, METH_NOARGS, NULL },
    {(char *) "get_something_prefixed", (PyCFunction) _wrap_foo4some_object_get_something_prefixed, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "set_zbr_transfer", (PyCFunction) _wrap_PySomeObject_set_zbr_transfer, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "add_prefix", (PyCFunction) _wrap_PySomeObject_add_prefix, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_prefix_with_foo_ptr", (PyCFunction) _wrap_PySomeObject_get_prefix_with_foo_ptr, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_pyobject", (PyCFunction) _wrap_PySomeObject_get_pyobject, METH_NOARGS, NULL },
    {(char *) "get_zbr", (PyCFunction) _wrap_PySomeObject_get_zbr, METH_NOARGS, NULL },
    {(char *) "get_zbr_pholder", (PyCFunction) _wrap_PySomeObject_get_zbr_pholder, METH_NOARGS, NULL },
    {(char *) "set_foo_value", (PyCFunction) _wrap_PySomeObject_set_foo_value, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_foobar_with_self_as_custodian", (PyCFunction) _wrap_PySomeObject_get_foobar_with_self_as_custodian, METH_NOARGS, NULL },
    {(char *) "set_foo_shared_ptr", (PyCFunction) _wrap_PySomeObject_set_foo_shared_ptr, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_internal_zbr", (PyCFunction) _wrap_PySomeObject_get_internal_zbr, METH_NOARGS, NULL },
    {(char *) "set_pyobject", (PyCFunction) _wrap_PySomeObject_set_pyobject, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_foobar_with_other_as_custodian", (PyCFunction) _wrap_PySomeObject_get_foobar_with_other_as_custodian, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_foo_by_ref", (PyCFunction) _wrap_PySomeObject_get_foo_by_ref, METH_NOARGS, NULL },
    {(char *) "get_prefix_with_foo_value", (PyCFunction) _wrap_PySomeObject_get_prefix_with_foo_value, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "set_zbr_pholder", (PyCFunction) _wrap_PySomeObject_set_zbr_pholder, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_prefix", (PyCFunction) _wrap_PySomeObject_get_prefix, METH_NOARGS, NULL },
    {(char *) "get_foo_shared_ptr", (PyCFunction) _wrap_PySomeObject_get_foo_shared_ptr, METH_NOARGS, NULL },
    {(char *) "get_foo_ptr", (PyCFunction) _wrap_PySomeObject_get_foo_ptr, METH_NOARGS, NULL },
    {(char *) "set_zbr_shared", (PyCFunction) _wrap_PySomeObject_set_zbr_shared, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_something", (PyCFunction) _wrap_PySomeObject_get_something, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_int", (PyCFunction) _wrap_PySomeObject_get_int, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "set_foobar_with_self_as_custodian", (PyCFunction) _wrap_PySomeObject_set_foobar_with_self_as_custodian, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "val_get_something_prefixed", (PyCFunction) _wrap_foo4some_object_val_get_something_prefixed, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "protected_method_that_is_not_virtual", (PyCFunction) PySomeObject__PythonHelper::_wrap_protected_method_that_is_not_virtual, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PySomeObject__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
PySomeObject__tp_clear(PySomeObject *self)
{
    Py_CLEAR(self->inst_dict);
        SomeObject *tmp = self->obj;
    self->obj = NULL;
    if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
        delete tmp;
    }
}


static int
PySomeObject__tp_traverse(PySomeObject *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);
    
    if (self->obj && typeid(*self->obj) == typeid(PySomeObject__PythonHelper) )
        Py_VISIT((PyObject *) self);

    return 0;
}


static void
_wrap_PySomeObject__tp_dealloc(PySomeObject *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PySomeObject_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PySomeObject_wrapper_registry.end()) {
        PySomeObject_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
    PySomeObject__tp_clear(self);
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PySomeObject__tp_richcompare (PySomeObject *PYBINDGEN_UNUSED(self), PySomeObject *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PySomeObject_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PySomeObject_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.SomeObject",            /* tp_name */
    sizeof(PySomeObject),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySomeObject__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)_wrap_PySomeObject___call__,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PySomeObject__tp_traverse,     /* tp_traverse */
    (inquiry)PySomeObject__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PySomeObject__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PySomeObject_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    PySomeObject__getsets,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    offsetof(PySomeObject, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PySomeObject__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};




pybindgen::TypeMap PySomeObjectNestedClass__typeid_map;

std::map<void*, PyObject*> PySomeObjectNestedClass_wrapper_registry;
static PyObject* _wrap_PySomeObjectNestedClass__get_instance_count(PyObject * PYBINDGEN_UNUSED(obj), void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "i", SomeObject::NestedClass::instance_count);
    return py_retval;
}
static int _wrap_PySomeObjectNestedClass__set_instance_count(PySomeObjectNestedClass * PYBINDGEN_UNUSED(dummy), PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &SomeObject::NestedClass::instance_count)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef SomeObjectNestedClassMeta__getsets[] = {
    {
        (char*) "instance_count", /* attribute name */
        (getter) _wrap_PySomeObjectNestedClass__get_instance_count, /* C function to get the attribute */
        (setter) _wrap_PySomeObjectNestedClass__set_instance_count, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject PySomeObjectNestedClassMeta_Type = {
	PyObject_HEAD_INIT(NULL)
	0,					/* ob_size */
	(char *) "SomeObjectNestedClassMeta",		        /* tp_name */
	0,					/* tp_basicsize */
	0,					/* tp_itemsize */
	0,	 				/* tp_dealloc */
	0,					/* tp_print */
	0,					/* tp_getattr */
	0,					/* tp_setattr */
	0,					/* tp_compare */
	0,					/* tp_repr */
	0,					/* tp_as_number */
	0,					/* tp_as_sequence */
	0,		       			/* tp_as_mapping */
	0,					/* tp_hash */
	0,					/* tp_call */
	0,					/* tp_str */
	0,					/* tp_getattro */
	0,					/* tp_setattro */
	0,					/* tp_as_buffer */
	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_BASETYPE, /* tp_flags */
 	0,					/* tp_doc */
	0,					/* tp_traverse */
 	0,					/* tp_clear */
	0,					/* tp_richcompare */
	0,					/* tp_weaklistoffset */
	0,					/* tp_iter */
	0,					/* tp_iternext */
	0,					/* tp_methods */
	0,					/* tp_members */
	SomeObjectNestedClassMeta__getsets,				/* tp_getset */
	0,					/* tp_base */
	0,					/* tp_dict */
	0,	                                /* tp_descr_get */
	0,  		                        /* tp_descr_set */
	0,					/* tp_dictoffset */
	0,					/* tp_init */
	0,					/* tp_alloc */
	0,					/* tp_new */
	0,               			/* tp_free */
        0,                                      /* tp_is_gc */
        0,                                      /* tp_bases */
        0,                                      /* tp_mro */
        0,                                      /* tp_cache */
        0,                                      /* tp_subclasses */
        0,                                      /* tp_weaklist */
        0                                       /* tp_del */
};



static int
_wrap_PySomeObjectNestedClass__tp_init__0(PySomeObjectNestedClass *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new SomeObject::NestedClass();
    return 0;
}

static int
_wrap_PySomeObjectNestedClass__tp_init__1(PySomeObjectNestedClass *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *datum;
    Py_ssize_t datum_len;
    const char *keywords[] = {"datum", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &datum, &datum_len)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new SomeObject::NestedClass(std::string(datum, datum_len));
    return 0;
}

static int
_wrap_PySomeObjectNestedClass__tp_init__2(PySomeObjectNestedClass *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PySomeObjectNestedClass *other;
    const char *keywords[] = {"other", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PySomeObjectNestedClass_Type, &other)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new SomeObject::NestedClass(*((PySomeObjectNestedClass *) other)->obj);
    return 0;
}

int _wrap_PySomeObjectNestedClass__tp_init(PySomeObjectNestedClass *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[3] = {0,};
    retval = _wrap_PySomeObjectNestedClass__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PySomeObjectNestedClass__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    retval = _wrap_PySomeObjectNestedClass__tp_init__2(self, args, kwargs, &exceptions[2]);
    if (!exceptions[2]) {
        Py_DECREF(exceptions[0]);
        Py_DECREF(exceptions[1]);
        return retval;
    }
    error_list = PyList_New(3);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyList_SET_ITEM(error_list, 2, PyObject_Str(exceptions[2]));
    Py_DECREF(exceptions[2]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PySomeObjectNestedClass_get_datum(PySomeObjectNestedClass *self)
{
    PyObject *py_retval;
    std::string retval;
    
    retval = self->obj->get_datum();
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


static PyObject*
_wrap_PySomeObjectNestedClass__copy__(PySomeObjectNestedClass *self)
{

    PySomeObjectNestedClass *py_copy;
    py_copy = PyObject_New(PySomeObjectNestedClass, &PySomeObjectNestedClass_Type);
    py_copy->obj = new SomeObject::NestedClass(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PySomeObjectNestedClass_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PySomeObjectNestedClass_methods[] = {
    {(char *) "get_datum", (PyCFunction) _wrap_PySomeObjectNestedClass_get_datum, METH_NOARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PySomeObjectNestedClass__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PySomeObjectNestedClass__tp_dealloc(PySomeObjectNestedClass *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PySomeObjectNestedClass_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PySomeObjectNestedClass_wrapper_registry.end()) {
        PySomeObjectNestedClass_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        SomeObject::NestedClass *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PySomeObjectNestedClass__tp_richcompare (PySomeObjectNestedClass *PYBINDGEN_UNUSED(self), PySomeObjectNestedClass *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PySomeObjectNestedClass_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PySomeObjectNestedClass_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.SomeObject.NestedClass",            /* tp_name */
    sizeof(PySomeObjectNestedClass),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySomeObjectNestedClass__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PySomeObjectNestedClass__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PySomeObjectNestedClass_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PySomeObjectNestedClass__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyTestContainer_wrapper_registry;

SimpleStructList
PyTestContainer__PythonHelper::get_simple_list()
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    SimpleStructList retval;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_simple_list"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::get_simple_list();
    }
    self_obj_before = reinterpret_cast< PyTestContainer* >(m_pyself)->obj;
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = (TestContainer*) this;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_simple_list", (char *) "");
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::get_simple_list();
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "O&", _wrap_convert_py2c__SimpleStructList, &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::get_simple_list();
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

SimpleStructMap
PyTestContainer__PythonHelper::get_simple_map()
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    SimpleStructMap retval;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_simple_map"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::get_simple_map();
    }
    self_obj_before = reinterpret_cast< PyTestContainer* >(m_pyself)->obj;
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = (TestContainer*) this;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_simple_map", (char *) "");
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::get_simple_map();
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "O&", _wrap_convert_py2c__SimpleStructMap, &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::get_simple_map();
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

SimpleStructVec
PyTestContainer__PythonHelper::get_simple_vec()
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    SimpleStructVec retval;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_simple_vec"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::get_simple_vec();
    }
    self_obj_before = reinterpret_cast< PyTestContainer* >(m_pyself)->obj;
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = (TestContainer*) this;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_simple_vec", (char *) "");
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::get_simple_vec();
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "O&", _wrap_convert_py2c__SimpleStructVec, &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::get_simple_vec();
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

int
PyTestContainer__PythonHelper::set_simple_list(SimpleStructList list)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    int retval;
    PySimpleStructList *py_SimpleStructList;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "set_simple_list"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_list(list);
    }
    self_obj_before = reinterpret_cast< PyTestContainer* >(m_pyself)->obj;
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = (TestContainer*) this;
    py_SimpleStructList = PyObject_New(PySimpleStructList, &PySimpleStructList_Type);
    py_SimpleStructList->obj = new SimpleStructList(list);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "set_simple_list", (char *) "N", py_SimpleStructList);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_list(list);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_list(list);
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

int
PyTestContainer__PythonHelper::set_simple_list_by_ref(SimpleStructList & inout_list)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    int retval;
    PySimpleStructList *py_SimpleStructList;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "set_simple_list_by_ref"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_list_by_ref(inout_list);
    }
    self_obj_before = reinterpret_cast< PyTestContainer* >(m_pyself)->obj;
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = (TestContainer*) this;
    py_SimpleStructList = PyObject_New(PySimpleStructList, &PySimpleStructList_Type);
    py_SimpleStructList->obj = new SimpleStructList(inout_list);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "set_simple_list_by_ref", (char *) "N", py_SimpleStructList);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_list_by_ref(inout_list);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "iO&", &retval, _wrap_convert_py2c__SimpleStructList, &inout_list)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_list_by_ref(inout_list);
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

int
PyTestContainer__PythonHelper::set_simple_map(SimpleStructMap map)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    int retval;
    PySimpleStructMap *py_SimpleStructMap;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "set_simple_map"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_map(map);
    }
    self_obj_before = reinterpret_cast< PyTestContainer* >(m_pyself)->obj;
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = (TestContainer*) this;
    py_SimpleStructMap = PyObject_New(PySimpleStructMap, &PySimpleStructMap_Type);
    py_SimpleStructMap->obj = new SimpleStructMap(map);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "set_simple_map", (char *) "N", py_SimpleStructMap);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_map(map);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_map(map);
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

int
PyTestContainer__PythonHelper::set_simple_vec(SimpleStructVec vec)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    int retval;
    PySimpleStructVec *py_SimpleStructVec;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "set_simple_vec"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_vec(vec);
    }
    self_obj_before = reinterpret_cast< PyTestContainer* >(m_pyself)->obj;
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = (TestContainer*) this;
    py_SimpleStructVec = PyObject_New(PySimpleStructVec, &PySimpleStructVec_Type);
    py_SimpleStructVec->obj = new SimpleStructVec(vec);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "set_simple_vec", (char *) "N", py_SimpleStructVec);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_vec(vec);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return TestContainer::set_simple_vec(vec);
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyTestContainer* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}
static PyObject* _wrap_PyTestContainer__get_m_floatSet(PyTestContainer *self, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    Pystd__set__lt___float___gt__ *py_std__set__lt___float___gt__;
    
    py_std__set__lt___float___gt__ = PyObject_New(Pystd__set__lt___float___gt__, &Pystd__set__lt___float___gt___Type);
    py_std__set__lt___float___gt__->obj = new std::set< float >(self->obj->m_floatSet);
    py_retval = Py_BuildValue((char *) "N", py_std__set__lt___float___gt__);
    return py_retval;
}
static int _wrap_PyTestContainer__set_m_floatSet(PyTestContainer *self, PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "O&", _wrap_convert_py2c__std__set__lt___float___gt__, &self->obj->m_floatSet)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef PyTestContainer__getsets[] = {
    {
        (char*) "m_floatSet", /* attribute name */
        (getter) _wrap_PyTestContainer__get_m_floatSet, /* C function to get the attribute */
        (setter) _wrap_PyTestContainer__set_m_floatSet, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    { NULL, NULL, NULL, NULL, NULL }
};


static int
_wrap_PyTestContainer__tp_init__0(PyTestContainer *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyTestContainer *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyTestContainer_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PyTestContainer_Type)
    {
        self->obj = new PyTestContainer__PythonHelper(*((PyTestContainer *) arg0)->obj);
        ((PyTestContainer__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new TestContainer(*((PyTestContainer *) arg0)->obj);
    }
    return 0;
}

static int
_wrap_PyTestContainer__tp_init__1(PyTestContainer *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PyTestContainer_Type)
    {
        self->obj = new PyTestContainer__PythonHelper();
        ((PyTestContainer__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new TestContainer();
    }
    return 0;
}

int _wrap_PyTestContainer__tp_init(PyTestContainer *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyTestContainer__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyTestContainer__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyTestContainer_get_simple_map(PyTestContainer *self)
{
    PyObject *py_retval;
    SimpleStructMap retval;
    PyTestContainer__PythonHelper *helper_class = dynamic_cast<PyTestContainer__PythonHelper*> (self->obj);
    PySimpleStructMap *py_SimpleStructMap;
    
    retval = (helper_class == NULL)? (self->obj->get_simple_map()) : (self->obj->TestContainer::get_simple_map());
    py_SimpleStructMap = PyObject_New(PySimpleStructMap, &PySimpleStructMap_Type);
    py_SimpleStructMap->obj = new SimpleStructMap(retval);
    py_retval = Py_BuildValue((char *) "N", py_SimpleStructMap);
    return py_retval;
}


PyObject *
_wrap_PyTestContainer_get_simple_vec(PyTestContainer *self)
{
    PyObject *py_retval;
    SimpleStructVec retval;
    PyTestContainer__PythonHelper *helper_class = dynamic_cast<PyTestContainer__PythonHelper*> (self->obj);
    PySimpleStructVec *py_SimpleStructVec;
    
    retval = (helper_class == NULL)? (self->obj->get_simple_vec()) : (self->obj->TestContainer::get_simple_vec());
    py_SimpleStructVec = PyObject_New(PySimpleStructVec, &PySimpleStructVec_Type);
    py_SimpleStructVec->obj = new SimpleStructVec(retval);
    py_retval = Py_BuildValue((char *) "N", py_SimpleStructVec);
    return py_retval;
}


PyObject *
_wrap_PyTestContainer_set_vec_ptr(PyTestContainer *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    std::vector< std::string > inVec_value;
    const char *keywords[] = {"inVec", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O&", (char **) keywords, _wrap_convert_py2c__std__vector__lt___std__string___gt__, &inVec_value)) {
        return NULL;
    }
    self->obj->set_vec_ptr(new std::vector< std::string >(inVec_value));
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PyTestContainer_set_simple_list(PyTestContainer *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    SimpleStructList list_value;
    PyTestContainer__PythonHelper *helper_class = dynamic_cast<PyTestContainer__PythonHelper*> (self->obj);
    const char *keywords[] = {"list", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O&", (char **) keywords, _wrap_convert_py2c__SimpleStructList, &list_value)) {
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->set_simple_list(list_value)) : (self->obj->TestContainer::set_simple_list(list_value));
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_PyTestContainer_set_simple_vec(PyTestContainer *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    SimpleStructVec vec_value;
    PyTestContainer__PythonHelper *helper_class = dynamic_cast<PyTestContainer__PythonHelper*> (self->obj);
    const char *keywords[] = {"vec", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O&", (char **) keywords, _wrap_convert_py2c__SimpleStructVec, &vec_value)) {
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->set_simple_vec(vec_value)) : (self->obj->TestContainer::set_simple_vec(vec_value));
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_PyTestContainer_get_simple_list(PyTestContainer *self)
{
    PyObject *py_retval;
    SimpleStructList retval;
    PyTestContainer__PythonHelper *helper_class = dynamic_cast<PyTestContainer__PythonHelper*> (self->obj);
    PySimpleStructList *py_SimpleStructList;
    
    retval = (helper_class == NULL)? (self->obj->get_simple_list()) : (self->obj->TestContainer::get_simple_list());
    py_SimpleStructList = PyObject_New(PySimpleStructList, &PySimpleStructList_Type);
    py_SimpleStructList->obj = new SimpleStructList(retval);
    py_retval = Py_BuildValue((char *) "N", py_SimpleStructList);
    return py_retval;
}


PyObject *
_wrap_PyTestContainer_set_simple_map(PyTestContainer *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    SimpleStructMap map_value;
    PyTestContainer__PythonHelper *helper_class = dynamic_cast<PyTestContainer__PythonHelper*> (self->obj);
    const char *keywords[] = {"map", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O&", (char **) keywords, _wrap_convert_py2c__SimpleStructMap, &map_value)) {
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->set_simple_map(map_value)) : (self->obj->TestContainer::set_simple_map(map_value));
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_PyTestContainer_set_simple_list_by_ref(PyTestContainer *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    SimpleStructList inout_list_value;
    PySimpleStructList *py_SimpleStructList;
    PyTestContainer__PythonHelper *helper_class = dynamic_cast<PyTestContainer__PythonHelper*> (self->obj);
    const char *keywords[] = {"inout_list", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O&", (char **) keywords, _wrap_convert_py2c__SimpleStructList, &inout_list_value)) {
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->set_simple_list_by_ref(inout_list_value)) : (self->obj->TestContainer::set_simple_list_by_ref(inout_list_value));
    py_SimpleStructList = PyObject_New(PySimpleStructList, &PySimpleStructList_Type);
    py_SimpleStructList->obj = new SimpleStructList(inout_list_value);
    py_retval = Py_BuildValue((char *) "iN", retval, py_SimpleStructList);
    return py_retval;
}


PyObject *
_wrap_PyTestContainer_get_vec_ptr(PyTestContainer *self)
{
    PyObject *py_retval;
    std::vector< std::string > *outVec_value = new std::vector< std::string >;
    Pystd__vector__lt___std__string___gt__ *py_std__vector__lt___std__string___gt__;
    
    self->obj->get_vec_ptr(outVec_value);
    py_std__vector__lt___std__string___gt__ = PyObject_New(Pystd__vector__lt___std__string___gt__, &Pystd__vector__lt___std__string___gt___Type);
    py_std__vector__lt___std__string___gt__->obj = outVec_value;
    py_retval = Py_BuildValue((char *) "N", py_std__vector__lt___std__string___gt__);
    return py_retval;
}


PyObject *
_wrap_PyTestContainer_get_vec(PyTestContainer *self)
{
    PyObject *py_retval;
    std::vector< std::string > outVec_value;
    Pystd__vector__lt___std__string___gt__ *py_std__vector__lt___std__string___gt__;
    
    self->obj->get_vec(outVec_value);
    py_std__vector__lt___std__string___gt__ = PyObject_New(Pystd__vector__lt___std__string___gt__, &Pystd__vector__lt___std__string___gt___Type);
    py_std__vector__lt___std__string___gt__->obj = new std::vector< std::string >(outVec_value);
    py_retval = Py_BuildValue((char *) "N", py_std__vector__lt___std__string___gt__);
    return py_retval;
}


static PyObject*
_wrap_PyTestContainer__copy__(PyTestContainer *self)
{

    PyTestContainer *py_copy;
    py_copy = PyObject_GC_New(PyTestContainer, &PyTestContainer_Type);
    py_copy->obj = new TestContainer(*self->obj);
    py_copy->inst_dict = NULL;
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyTestContainer_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyTestContainer_methods[] = {
    {(char *) "get_simple_map", (PyCFunction) _wrap_PyTestContainer_get_simple_map, METH_NOARGS, NULL },
    {(char *) "get_simple_vec", (PyCFunction) _wrap_PyTestContainer_get_simple_vec, METH_NOARGS, NULL },
    {(char *) "set_vec_ptr", (PyCFunction) _wrap_PyTestContainer_set_vec_ptr, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "set_simple_list", (PyCFunction) _wrap_PyTestContainer_set_simple_list, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "set_simple_vec", (PyCFunction) _wrap_PyTestContainer_set_simple_vec, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_simple_list", (PyCFunction) _wrap_PyTestContainer_get_simple_list, METH_NOARGS, NULL },
    {(char *) "set_simple_map", (PyCFunction) _wrap_PyTestContainer_set_simple_map, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "set_simple_list_by_ref", (PyCFunction) _wrap_PyTestContainer_set_simple_list_by_ref, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_vec_ptr", (PyCFunction) _wrap_PyTestContainer_get_vec_ptr, METH_NOARGS, NULL },
    {(char *) "get_vec", (PyCFunction) _wrap_PyTestContainer_get_vec, METH_NOARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyTestContainer__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
PyTestContainer__tp_clear(PyTestContainer *self)
{
    Py_CLEAR(self->inst_dict);
        TestContainer *tmp = self->obj;
    self->obj = NULL;
    if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
        delete tmp;
    }
}


static int
PyTestContainer__tp_traverse(PyTestContainer *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);
    
    if (self->obj && typeid(*self->obj) == typeid(PyTestContainer__PythonHelper) )
        Py_VISIT((PyObject *) self);

    return 0;
}


static void
_wrap_PyTestContainer__tp_dealloc(PyTestContainer *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyTestContainer_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyTestContainer_wrapper_registry.end()) {
        PyTestContainer_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
    PyTestContainer__tp_clear(self);
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyTestContainer__tp_richcompare (PyTestContainer *PYBINDGEN_UNUSED(self), PyTestContainer *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyTestContainer_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyTestContainer_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.TestContainer",            /* tp_name */
    sizeof(PyTestContainer),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyTestContainer__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PyTestContainer__tp_traverse,     /* tp_traverse */
    (inquiry)PyTestContainer__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PyTestContainer__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyTestContainer_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    PyTestContainer__getsets,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    offsetof(PyTestContainer, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PyTestContainer__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyTupl_wrapper_registry;
static PyObject* _wrap_PyTupl__get_x(PyTupl *self, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "i", self->obj->x);
    return py_retval;
}
static int _wrap_PyTupl__set_x(PyTupl *self, PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &self->obj->x)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Py_DECREF(py_retval);
    return 0;
}
static PyObject* _wrap_PyTupl__get_y(PyTupl *self, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "i", self->obj->y);
    return py_retval;
}
static int _wrap_PyTupl__set_y(PyTupl *self, PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &self->obj->y)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef PyTupl__getsets[] = {
    {
        (char*) "y", /* attribute name */
        (getter) _wrap_PyTupl__get_y, /* C function to get the attribute */
        (setter) _wrap_PyTupl__set_y, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    {
        (char*) "x", /* attribute name */
        (getter) _wrap_PyTupl__get_x, /* C function to get the attribute */
        (setter) _wrap_PyTupl__set_x, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    { NULL, NULL, NULL, NULL, NULL }
};


static int
_wrap_PyTupl__tp_init__0(PyTupl *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new Tupl();
    return 0;
}

static int
_wrap_PyTupl__tp_init__1(PyTupl *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyTupl *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyTupl_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new Tupl(*((PyTupl *) arg0)->obj);
    return 0;
}

int _wrap_PyTupl__tp_init(PyTupl *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyTupl__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyTupl__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


static PyObject*
_wrap_PyTupl__copy__(PyTupl *self)
{

    PyTupl *py_copy;
    py_copy = PyObject_New(PyTupl, &PyTupl_Type);
    py_copy->obj = new Tupl(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyTupl_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyTupl_methods[] = {
    {(char *) "__copy__", (PyCFunction) _wrap_PyTupl__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyTupl__tp_dealloc(PyTupl *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyTupl_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyTupl_wrapper_registry.end()) {
        PyTupl_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        Tupl *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyTupl__tp_richcompare (PyTupl *PYBINDGEN_UNUSED(self), PyTupl *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyTupl_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        if (*self->obj < *other->obj) {
            Py_INCREF(Py_True);
            return Py_True;
        } else {
            Py_INCREF(Py_False);
            return Py_False;
        }
    case Py_LE:
        if (*self->obj <= *other->obj) {
            Py_INCREF(Py_True);
            return Py_True;
        } else {
            Py_INCREF(Py_False);
            return Py_False;
        }
    case Py_EQ:
        if (*self->obj == *other->obj) {
            Py_INCREF(Py_True);
            return Py_True;
        } else {
            Py_INCREF(Py_False);
            return Py_False;
        }
    case Py_NE:
        if (*self->obj != *other->obj) {
            Py_INCREF(Py_True);
            return Py_True;
        } else {
            Py_INCREF(Py_False);
            return Py_False;
        }
    case Py_GE:
        if (*self->obj >= *other->obj) {
            Py_INCREF(Py_True);
            return Py_True;
        } else {
            Py_INCREF(Py_False);
            return Py_False;
        }
    case Py_GT:
        if (*self->obj > *other->obj) {
            Py_INCREF(Py_True);
            return Py_True;
        } else {
            Py_INCREF(Py_False);
            return Py_False;
        }
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}


PyObject* _wrap_convert_c2py__Tupl(Tupl *cvalue)
{
    PyObject *py_retval;
    PyTupl *py_Tupl;
    
    py_Tupl = PyObject_New(PyTupl, &PyTupl_Type);
    py_Tupl->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_Tupl->obj = new Tupl(*cvalue);
    PyTupl_wrapper_registry[(void *) py_Tupl->obj] = (PyObject *) py_Tupl;
    py_retval = Py_BuildValue((char *) "N", py_Tupl);
    return py_retval;
}


int _wrap_convert_py2c__Tupl(PyObject *value, Tupl *address)
{
    PyObject *py_retval;
    PyTupl *tmp_Tupl;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "O!", &PyTupl_Type, &tmp_Tupl)) {
        Py_DECREF(py_retval);
        return 0;
    }
    *address = *tmp_Tupl->obj;
    Py_DECREF(py_retval);
    return 1;
}


int _wrap_convert_py2c__Tupl_const___amp__(PyObject *value, Tupl *address)
{
    PyObject *py_retval;
    PyTupl *tmp_Tupl;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "O!", &PyTupl_Type, &tmp_Tupl)) {
        Py_DECREF(py_retval);
        return 0;
    }
    *address = *tmp_Tupl->obj;
    Py_DECREF(py_retval);
    return 1;
}


int _wrap_convert_py2c__int(PyObject *value, int *address)
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &*address)) {
        Py_DECREF(py_retval);
        return 0;
    }
    Py_DECREF(py_retval);
    return 1;
}

static PyObject*
Tupl__nb_add (PyObject *py_left, PyObject *py_right)
{
    {
        Tupl left;
        Tupl right;
        if (_wrap_convert_py2c__Tupl(py_left, &left) && _wrap_convert_py2c__Tupl_const___amp__(py_right, &right)) {
            Tupl result = (left + right);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}
static PyObject*
Tupl__nb_subtract (PyObject *py_left, PyObject *py_right)
{
    {
        Tupl left;
        Tupl right;
        if (_wrap_convert_py2c__Tupl(py_left, &left) && _wrap_convert_py2c__Tupl_const___amp__(py_right, &right)) {
            Tupl result = (left - right);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}
static PyObject*
Tupl__nb_multiply (PyObject *py_left, PyObject *py_right)
{
    {
        Tupl left;
        Tupl right;
        if (_wrap_convert_py2c__Tupl(py_left, &left) && _wrap_convert_py2c__Tupl_const___amp__(py_right, &right)) {
            Tupl result = (left * right);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}
static PyObject*
Tupl__nb_divide (PyObject *py_left, PyObject *py_right)
{
    {
        Tupl left;
        Tupl right;
        if (_wrap_convert_py2c__Tupl(py_left, &left) && _wrap_convert_py2c__Tupl_const___amp__(py_right, &right)) {
            Tupl result = (left / right);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}
static PyObject*
Tupl__nb_inplace_add (PyObject *py_left, PyObject *py_right)
{
    {
        Tupl left;
        int right;
        if (_wrap_convert_py2c__Tupl(py_left, &left) && _wrap_convert_py2c__int(py_right, &right)) {
            Tupl result = (left += right);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    {
        Tupl left;
        Tupl right;
        if (_wrap_convert_py2c__Tupl(py_left, &left) && _wrap_convert_py2c__Tupl_const___amp__(py_right, &right)) {
            Tupl result = (left += right);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}
static PyObject*
Tupl__nb_inplace_subtract (PyObject *py_left, PyObject *py_right)
{
    {
        Tupl left;
        Tupl right;
        if (_wrap_convert_py2c__Tupl(py_left, &left) && _wrap_convert_py2c__Tupl_const___amp__(py_right, &right)) {
            Tupl result = (left -= right);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}
static PyObject*
Tupl__nb_inplace_multiply (PyObject *py_left, PyObject *py_right)
{
    {
        Tupl left;
        Tupl right;
        if (_wrap_convert_py2c__Tupl(py_left, &left) && _wrap_convert_py2c__Tupl_const___amp__(py_right, &right)) {
            Tupl result = (left *= right);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}
static PyObject*
Tupl__nb_inplace_divide (PyObject *py_left, PyObject *py_right)
{
    {
        Tupl left;
        Tupl right;
        if (_wrap_convert_py2c__Tupl(py_left, &left) && _wrap_convert_py2c__Tupl_const___amp__(py_right, &right)) {
            Tupl result = (left /= right);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}
static PyObject*
Tupl__nb_negative (PyObject *py_self)
{
    {
        Tupl self;
        if (_wrap_convert_py2c__Tupl(py_self, &self)) {
            Tupl result = -(self);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}
static PyNumberMethods Tupl__py_number_methods = {
    (binaryfunc) Tupl__nb_add,
    (binaryfunc) Tupl__nb_subtract,
    (binaryfunc) Tupl__nb_multiply,
    (binaryfunc) Tupl__nb_divide,
    (binaryfunc) NULL,
    (binaryfunc) NULL,
    (ternaryfunc) NULL,
    (unaryfunc) Tupl__nb_negative,
    (unaryfunc) NULL,
    (unaryfunc) NULL,
    (inquiry) NULL,
    (unaryfunc) NULL,
    (binaryfunc) NULL,
    (binaryfunc) NULL,
    (binaryfunc) NULL,
    (binaryfunc) NULL,
    (binaryfunc) NULL,
    (coercion) NULL,
    (unaryfunc) NULL,
    (unaryfunc) NULL,
    (unaryfunc) NULL,
    (unaryfunc) NULL,
    (unaryfunc) NULL,
    /* Added in release 2.0 */
    (binaryfunc) Tupl__nb_inplace_add,
    (binaryfunc) Tupl__nb_inplace_subtract,
    (binaryfunc) Tupl__nb_inplace_multiply,
    (binaryfunc) Tupl__nb_inplace_divide,
    (binaryfunc) NULL,
    (ternaryfunc) NULL,
    (binaryfunc) NULL,
    (binaryfunc) NULL,
    (binaryfunc) NULL,
    (binaryfunc) NULL,
    (binaryfunc) NULL,

    /* Added in release 2.2 */
    /* The following require the Py_TPFLAGS_HAVE_CLASS flag */
    (binaryfunc) NULL,
    (binaryfunc) NULL,
    (binaryfunc) NULL,
    (binaryfunc) NULL,

#if PY_VERSION_HEX >= 0x020500F0
    /* Added in release 2.5 */
    (unaryfunc) NULL,

#endif
};

PyTypeObject PyTupl_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.Tupl",            /* tp_name */
    sizeof(PyTupl),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyTupl__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)&Tupl__py_number_methods,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyTupl__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyTupl_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    PyTupl__getsets,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyTupl__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};




int
PyUdpSocket__PythonHelper::Bind()
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    UdpSocket *self_obj_before;
    PyObject *py_retval;
    int retval;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "Bind"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return UdpSocket::Bind();
    }
    self_obj_before = reinterpret_cast< PyUdpSocket* >(m_pyself)->obj;
    reinterpret_cast< PyUdpSocket* >(m_pyself)->obj = (UdpSocket*) this;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "Bind", (char *) "");
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyUdpSocket* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return UdpSocket::Bind();
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyUdpSocket* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return UdpSocket::Bind();
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyUdpSocket* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

int
PyUdpSocket__PythonHelper::Bind(int address)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    Socket *self_obj_before;
    PyObject *py_retval;
    int retval;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "Bind"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Socket::Bind(address);
    }
    self_obj_before = reinterpret_cast< PySocket* >(m_pyself)->obj;
    reinterpret_cast< PySocket* >(m_pyself)->obj = (Socket*) this;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "Bind", (char *) "i", address);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PySocket* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Socket::Bind(address);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PySocket* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Socket::Bind(address);
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PySocket* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}


static int
_wrap_PyUdpSocket__tp_init__0(PyUdpSocket *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PyUdpSocket_Type)
    {
        self->obj = new PyUdpSocket__PythonHelper();
        ((PyUdpSocket__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new UdpSocket();
    }
    return 0;
}

static int
_wrap_PyUdpSocket__tp_init__1(PyUdpSocket *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyUdpSocket *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyUdpSocket_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PyUdpSocket_Type)
    {
        self->obj = new PyUdpSocket__PythonHelper(*((PyUdpSocket *) arg0)->obj);
        ((PyUdpSocket__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new UdpSocket(*((PyUdpSocket *) arg0)->obj);
    }
    return 0;
}

int _wrap_PyUdpSocket__tp_init(PyUdpSocket *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyUdpSocket__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyUdpSocket__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyUdpSocket_Bind(PyUdpSocket *self)
{
    PyObject *py_retval;
    int retval;
    PyUdpSocket__PythonHelper *helper_class = dynamic_cast<PyUdpSocket__PythonHelper*> (self->obj);
    
    retval = (helper_class == NULL)? (self->obj->Bind()) : (self->obj->UdpSocket::Bind());
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


static PyObject*
_wrap_PyUdpSocket__copy__(PyUdpSocket *self)
{

    PyUdpSocket *py_copy;
    py_copy = PyObject_GC_New(PyUdpSocket, &PyUdpSocket_Type);
    py_copy->obj = new UdpSocket(*self->obj);
    py_copy->inst_dict = NULL;
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PySocket_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyUdpSocket_methods[] = {
    {(char *) "Bind", (PyCFunction) _wrap_PyUdpSocket_Bind, METH_NOARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyUdpSocket__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
PyUdpSocket__tp_clear(PyUdpSocket *self)
{
    Py_CLEAR(self->inst_dict);
        UdpSocket *tmp = self->obj;
    self->obj = NULL;
    if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
        delete tmp;
    }
}


static int
PyUdpSocket__tp_traverse(PyUdpSocket *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);
    
    if (self->obj && typeid(*self->obj) == typeid(PyUdpSocket__PythonHelper) )
        Py_VISIT((PyObject *) self);

    return 0;
}


static void
_wrap_PyUdpSocket__tp_dealloc(PyUdpSocket *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PySocket_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PySocket_wrapper_registry.end()) {
        PySocket_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
    PyUdpSocket__tp_clear(self);
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyUdpSocket__tp_richcompare (PyUdpSocket *PYBINDGEN_UNUSED(self), PyUdpSocket *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyUdpSocket_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyUdpSocket_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.UdpSocket",            /* tp_name */
    sizeof(PyUdpSocket),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyUdpSocket__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PyUdpSocket__tp_traverse,     /* tp_traverse */
    (inquiry)PyUdpSocket__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PyUdpSocket__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyUdpSocket_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    offsetof(PyUdpSocket, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PyUdpSocket__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyVectorLike_wrapper_registry;


static int
_wrap_PyVectorLike__tp_init__0(PyVectorLike *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyVectorLike *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyVectorLike_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new VectorLike(*((PyVectorLike *) arg0)->obj);
    return 0;
}

static int
_wrap_PyVectorLike__tp_init__1(PyVectorLike *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new VectorLike();
    return 0;
}

int _wrap_PyVectorLike__tp_init(PyVectorLike *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyVectorLike__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyVectorLike__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyVectorLike___setitem__(PyVectorLike *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    unsigned PY_LONG_LONG index;
    double value;
    const char *keywords[] = {"index", "value", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "Kd", (char **) keywords, &index, &value)) {
        return NULL;
    }
    self->obj->set_item(index, value);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject *
_wrap_PyVectorLike___len__(PyVectorLike *self)
{
    PyObject *py_retval;
    size_t retval;
    
    retval = self->obj->get_len();
    py_retval = Py_BuildValue((char *) "K", ((unsigned PY_LONG_LONG) retval));
    return py_retval;
}


PyObject *
_wrap_PyVectorLike___getitem__(PyVectorLike *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    double retval;
    unsigned PY_LONG_LONG index;
    const char *keywords[] = {"index", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "K", (char **) keywords, &index)) {
        return NULL;
    }
    retval = self->obj->get_item(index);
    py_retval = Py_BuildValue((char *) "d", retval);
    return py_retval;
}


PyObject *
_wrap_PyVectorLike_append(PyVectorLike *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    double value;
    const char *keywords[] = {"value", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "d", (char **) keywords, &value)) {
        return NULL;
    }
    self->obj->append(value);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


static PyObject*
_wrap_PyVectorLike__copy__(PyVectorLike *self)
{

    PyVectorLike *py_copy;
    py_copy = PyObject_New(PyVectorLike, &PyVectorLike_Type);
    py_copy->obj = new VectorLike(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyVectorLike_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyVectorLike_methods[] = {
    {(char *) "append", (PyCFunction) _wrap_PyVectorLike_append, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyVectorLike__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyVectorLike__tp_dealloc(PyVectorLike *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyVectorLike_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyVectorLike_wrapper_registry.end()) {
        PyVectorLike_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        VectorLike *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyVectorLike__tp_richcompare (PyVectorLike *PYBINDGEN_UNUSED(self), PyVectorLike *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyVectorLike_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}


int _wrap_convert_py2c__VectorLike(PyObject *value, VectorLike *address)
{
    PyObject *py_retval;
    PyVectorLike *tmp_VectorLike;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "O!", &PyVectorLike_Type, &tmp_VectorLike)) {
        Py_DECREF(py_retval);
        return 0;
    }
    *address = *tmp_VectorLike->obj;
    Py_DECREF(py_retval);
    return 1;
}


static Py_ssize_t
VectorLike__sq_length (PyVectorLike *py_self)
{
    PyObject *py_result;
    Py_ssize_t result;

    py_result = _wrap_PyVectorLike___len__(py_self);
    if (py_result == NULL) {
        return -1;
    }
    result = PyInt_AsSsize_t(py_result);
    Py_DECREF(py_result);
    return result;
}



static PyObject*
VectorLike__sq_item (PyVectorLike *py_self, Py_ssize_t py_i)
{
    PyObject *result;
    PyObject *args;

    args = Py_BuildValue("(i)", py_i);
    result = _wrap_PyVectorLike___getitem__(py_self, args, NULL);
    Py_DECREF(args);
    if (PyErr_ExceptionMatches(PyExc_IndexError) ||
        PyErr_ExceptionMatches(PyExc_StopIteration)) {
        Py_XDECREF(result);
        return NULL;
    } else {
        return result;
    }
}




static int
VectorLike__sq_ass_item (PyVectorLike *py_self, Py_ssize_t py_i, PyObject *py_val)
{
    PyObject *result;
    PyObject *args;

    args = Py_BuildValue("(iO)", py_i, py_val);
    result = _wrap_PyVectorLike___setitem__(py_self, args, NULL);
    Py_DECREF(args);
    if (result == NULL) {
        return -1;
    } else {
        Py_DECREF(result);
        return 0;
    }
}



static PySequenceMethods VectorLike__py_sequence_methods = {
    (lenfunc) VectorLike__sq_length,
    (binaryfunc) NULL,
    (ssizeargfunc) NULL,
    (ssizeargfunc) VectorLike__sq_item,
    (ssizessizeargfunc) NULL,
    (ssizeobjargproc) VectorLike__sq_ass_item,
    (ssizessizeobjargproc) NULL,
    (objobjproc) NULL,
    /* Added in release 2.0 */
    (binaryfunc) NULL,
    (ssizeargfunc) NULL,
};


PyTypeObject PyVectorLike_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.VectorLike",            /* tp_name */
    sizeof(PyVectorLike),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyVectorLike__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)&VectorLike__py_sequence_methods, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyVectorLike__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyVectorLike_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyVectorLike__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyVectorLike2_wrapper_registry;


static int
_wrap_PyVectorLike2__tp_init__0(PyVectorLike2 *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyVectorLike2 *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyVectorLike2_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new VectorLike2(*((PyVectorLike2 *) arg0)->obj);
    return 0;
}

static int
_wrap_PyVectorLike2__tp_init__1(PyVectorLike2 *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new VectorLike2();
    return 0;
}

int _wrap_PyVectorLike2__tp_init(PyVectorLike2 *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyVectorLike2__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyVectorLike2__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyVectorLike2_append(PyVectorLike2 *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    double value;
    const char *keywords[] = {"value", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "d", (char **) keywords, &value)) {
        return NULL;
    }
    self->obj->append(value);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


static PyObject*
_wrap_PyVectorLike2__copy__(PyVectorLike2 *self)
{

    PyVectorLike2 *py_copy;
    py_copy = PyObject_New(PyVectorLike2, &PyVectorLike2_Type);
    py_copy->obj = new VectorLike2(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyVectorLike2_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyVectorLike2_methods[] = {
    {(char *) "append", (PyCFunction) _wrap_PyVectorLike2_append, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyVectorLike2__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyVectorLike2__tp_dealloc(PyVectorLike2 *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyVectorLike2_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyVectorLike2_wrapper_registry.end()) {
        PyVectorLike2_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        VectorLike2 *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyVectorLike2__tp_richcompare (PyVectorLike2 *PYBINDGEN_UNUSED(self), PyVectorLike2 *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyVectorLike2_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}


static void
PyVectorLike2_Iter__tp_clear(PyVectorLike2_Iter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

}


static int
PyVectorLike2_Iter__tp_traverse(PyVectorLike2_Iter *self, visitproc visit, void *arg)
{
    Py_VISIT((PyObject *) self->container);
    return 0;
}


static void
_wrap_PyVectorLike2_Iter__tp_dealloc(PyVectorLike2_Iter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

    self->ob_type->tp_free((PyObject*)self);
}


static PyObject*
_wrap_PyVectorLike2__tp_iter(PyVectorLike2 *self)
{
    PyVectorLike2_Iter *iter = PyObject_GC_New(PyVectorLike2_Iter, &PyVectorLike2_IterType);
    Py_INCREF(self);
    iter->container = self;
    iter->iterator = new VectorLike2::Iterator(self->obj->Begin());
    return (PyObject*) iter;
}


static PyObject*
_wrap_PyVectorLike2_Iter__tp_iter(PyVectorLike2_Iter *self)
{
    Py_INCREF(self);
    return (PyObject*) self;
}

static PyObject* _wrap_PyVectorLike2_Iter__tp_iternext(PyVectorLike2_Iter *self)
{
    PyObject *py_retval;
    VectorLike2::Iterator iter;
    
    iter = *self->iterator;
    if (iter == self->container->obj->End()) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    ++(*self->iterator);
    py_retval = Py_BuildValue((char *) "d", (*iter));
    return py_retval;
}
PyTypeObject PyVectorLike2_IterType = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.VectorLike2Iter",            /* tp_name */
    sizeof(PyVectorLike2_Iter),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyVectorLike2_Iter__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PyVectorLike2_Iter__tp_traverse,     /* tp_traverse */
    (inquiry)PyVectorLike2_Iter__tp_clear,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_PyVectorLike2_Iter__tp_iter,          /* tp_iter */
    (iternextfunc)_wrap_PyVectorLike2_Iter__tp_iternext,     /* tp_iternext */
    (struct PyMethodDef*)NULL, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    NULL,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)NULL,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};

PyTypeObject PyVectorLike2_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.VectorLike2",            /* tp_name */
    sizeof(PyVectorLike2),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyVectorLike2__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyVectorLike2__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_PyVectorLike2__tp_iter,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyVectorLike2_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyVectorLike2__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyWord_wrapper_registry;
static PyObject* _wrap_PyWord__get_low(PyWord *self, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "i", (int)self->obj->low);
    return py_retval;
}
static int _wrap_PyWord__set_low(PyWord *self, PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    int tmp;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &tmp)) {
        Py_DECREF(py_retval);
        return -1;
    }
    if (tmp > 0xff) {
        PyErr_SetString(PyExc_ValueError, "Out of range");
        Py_DECREF(py_retval);
        return -1;
    }
    self->obj->low = tmp;
    Py_DECREF(py_retval);
    return 0;
}
static PyObject* _wrap_PyWord__get_high(PyWord *self, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "i", (int)self->obj->high);
    return py_retval;
}
static int _wrap_PyWord__set_high(PyWord *self, PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    int tmp;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &tmp)) {
        Py_DECREF(py_retval);
        return -1;
    }
    if (tmp > 0xff) {
        PyErr_SetString(PyExc_ValueError, "Out of range");
        Py_DECREF(py_retval);
        return -1;
    }
    self->obj->high = tmp;
    Py_DECREF(py_retval);
    return 0;
}
static PyObject* _wrap_PyWord__get_word(PyWord *self, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "i", self->obj->word);
    return py_retval;
}
static int _wrap_PyWord__set_word(PyWord *self, PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    int tmp;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &tmp)) {
        Py_DECREF(py_retval);
        return -1;
    }
    if (tmp > 0xffff) {
        PyErr_SetString(PyExc_ValueError, "Out of range");
        Py_DECREF(py_retval);
        return -1;
    }
    self->obj->word = tmp;
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef PyWord__getsets[] = {
    {
        (char*) "high", /* attribute name */
        (getter) _wrap_PyWord__get_high, /* C function to get the attribute */
        (setter) _wrap_PyWord__set_high, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    {
        (char*) "word", /* attribute name */
        (getter) _wrap_PyWord__get_word, /* C function to get the attribute */
        (setter) _wrap_PyWord__set_word, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    {
        (char*) "low", /* attribute name */
        (getter) _wrap_PyWord__get_low, /* C function to get the attribute */
        (setter) _wrap_PyWord__set_low, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    { NULL, NULL, NULL, NULL, NULL }
};


static int
_wrap_PyWord__tp_init__0(PyWord *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new Word();
    return 0;
}

static int
_wrap_PyWord__tp_init__1(PyWord *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyWord *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyWord_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new Word(*((PyWord *) arg0)->obj);
    return 0;
}

int _wrap_PyWord__tp_init(PyWord *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyWord__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyWord__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


static PyObject*
_wrap_PyWord__copy__(PyWord *self)
{

    PyWord *py_copy;
    py_copy = PyObject_New(PyWord, &PyWord_Type);
    py_copy->obj = new Word(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyWord_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyWord_methods[] = {
    {(char *) "__copy__", (PyCFunction) _wrap_PyWord__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyWord__tp_dealloc(PyWord *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyWord_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyWord_wrapper_registry.end()) {
        PyWord_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        Word *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyWord__tp_richcompare (PyWord *PYBINDGEN_UNUSED(self), PyWord *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyWord_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyWord_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.Word",            /* tp_name */
    sizeof(PyWord),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyWord__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyWord__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyWord_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    PyWord__getsets,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyWord__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyZbr_wrapper_registry;

int
PyZbr__PythonHelper::get_int(int x)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    Zbr *self_obj_before;
    PyObject *py_retval;
    int retval;
    
    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "get_int"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Zbr::get_int(x);
    }
    self_obj_before = reinterpret_cast< PyZbr* >(m_pyself)->obj;
    reinterpret_cast< PyZbr* >(m_pyself)->obj = (Zbr*) this;
    py_retval = PyObject_CallMethod(m_pyself, (char *) "get_int", (char *) "i", x);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyZbr* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Zbr::get_int(x);
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyZbr* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return Zbr::get_int(x);
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyZbr* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}
static PyObject* _wrap_PyZbr__get_instance_count(PyObject * PYBINDGEN_UNUSED(obj), void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "i", Zbr::instance_count);
    return py_retval;
}
static int _wrap_PyZbr__set_instance_count(PyZbr * PYBINDGEN_UNUSED(dummy), PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &Zbr::instance_count)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef ZbrMeta__getsets[] = {
    {
        (char*) "instance_count", /* attribute name */
        (getter) _wrap_PyZbr__get_instance_count, /* C function to get the attribute */
        (setter) _wrap_PyZbr__set_instance_count, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    { NULL, NULL, NULL, NULL, NULL }
};

PyTypeObject PyZbrMeta_Type = {
	PyObject_HEAD_INIT(NULL)
	0,					/* ob_size */
	(char *) "ZbrMeta",		        /* tp_name */
	0,					/* tp_basicsize */
	0,					/* tp_itemsize */
	0,	 				/* tp_dealloc */
	0,					/* tp_print */
	0,					/* tp_getattr */
	0,					/* tp_setattr */
	0,					/* tp_compare */
	0,					/* tp_repr */
	0,					/* tp_as_number */
	0,					/* tp_as_sequence */
	0,		       			/* tp_as_mapping */
	0,					/* tp_hash */
	0,					/* tp_call */
	0,					/* tp_str */
	0,					/* tp_getattro */
	0,					/* tp_setattro */
	0,					/* tp_as_buffer */
	Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC|Py_TPFLAGS_BASETYPE, /* tp_flags */
 	0,					/* tp_doc */
	0,					/* tp_traverse */
 	0,					/* tp_clear */
	0,					/* tp_richcompare */
	0,					/* tp_weaklistoffset */
	0,					/* tp_iter */
	0,					/* tp_iternext */
	0,					/* tp_methods */
	0,					/* tp_members */
	ZbrMeta__getsets,				/* tp_getset */
	0,					/* tp_base */
	0,					/* tp_dict */
	0,	                                /* tp_descr_get */
	0,  		                        /* tp_descr_set */
	0,					/* tp_dictoffset */
	0,					/* tp_init */
	0,					/* tp_alloc */
	0,					/* tp_new */
	0,               			/* tp_free */
        0,                                      /* tp_is_gc */
        0,                                      /* tp_bases */
        0,                                      /* tp_mro */
        0,                                      /* tp_cache */
        0,                                      /* tp_subclasses */
        0,                                      /* tp_weaklist */
        0                                       /* tp_del */
};



static int
_wrap_PyZbr__tp_init__0(PyZbr *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PyZbr_Type)
    {
        self->obj = new PyZbr__PythonHelper();
        ((PyZbr__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new Zbr();
    }
    return 0;
}

static int
_wrap_PyZbr__tp_init__1(PyZbr *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *datum;
    Py_ssize_t datum_len;
    const char *keywords[] = {"datum", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &datum, &datum_len)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PyZbr_Type)
    {
        self->obj = new PyZbr__PythonHelper(std::string(datum, datum_len));
        ((PyZbr__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new Zbr(std::string(datum, datum_len));
    }
    return 0;
}

static int
_wrap_PyZbr__tp_init__2(PyZbr *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyZbr *other;
    const char *keywords[] = {"other", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyZbr_Type, &other)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    if (self->ob_type != &PyZbr_Type)
    {
        self->obj = new PyZbr__PythonHelper(*((PyZbr *) other)->obj);
        ((PyZbr__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new Zbr(*((PyZbr *) other)->obj);
    }
    return 0;
}

int _wrap_PyZbr__tp_init(PyZbr *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[3] = {0,};
    retval = _wrap_PyZbr__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyZbr__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    retval = _wrap_PyZbr__tp_init__2(self, args, kwargs, &exceptions[2]);
    if (!exceptions[2]) {
        Py_DECREF(exceptions[0]);
        Py_DECREF(exceptions[1]);
        return retval;
    }
    error_list = PyList_New(3);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyList_SET_ITEM(error_list, 2, PyObject_Str(exceptions[2]));
    Py_DECREF(exceptions[2]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyZbr_get_datum(PyZbr *self)
{
    PyObject *py_retval;
    std::string retval;
    
    retval = self->obj->get_datum();
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


PyObject *
_wrap_PyZbr_get_value(PyZbr *self)
{
    PyObject *py_retval;
    int retval;
    int  foobaz;
    
    retval = self->obj->get_value(&foobaz);
    py_retval = Py_BuildValue((char *) "ii", retval, foobaz);
    return py_retval;
}


PyObject *
_wrap_PyZbr_get_int(PyZbr *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    int x;
    PyZbr__PythonHelper *helper_class = dynamic_cast<PyZbr__PythonHelper*> (self->obj);
    const char *keywords[] = {"x", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &x)) {
        return NULL;
    }
    retval = (helper_class == NULL)? (self->obj->get_int(x)) : (self->obj->Zbr::get_int(x));
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


static PyObject*
_wrap_PyZbr__copy__(PyZbr *self)
{

    PyZbr *py_copy;
    py_copy = PyObject_GC_New(PyZbr, &PyZbr_Type);
    py_copy->obj = new Zbr(*self->obj);
    py_copy->inst_dict = NULL;
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyZbr_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyZbr_methods[] = {
    {(char *) "get_datum", (PyCFunction) _wrap_PyZbr_get_datum, METH_NOARGS, NULL },
    {(char *) "get_value", (PyCFunction) _wrap_PyZbr_get_value, METH_NOARGS, NULL },
    {(char *) "get_int", (PyCFunction) _wrap_PyZbr_get_int, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyZbr__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
PyZbr__tp_clear(PyZbr *self)
{
    Py_CLEAR(self->inst_dict);
    if (self->obj) {
    Zbr *tmp = self->obj;
    self->obj = NULL;
    tmp->Unref();
}
}


static int
PyZbr__tp_traverse(PyZbr *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);
    
    if (self->obj && typeid(*self->obj) == typeid(PyZbr__PythonHelper)  && self->obj->GetReferenceCount() == 1)
        Py_VISIT((PyObject *) self);

    return 0;
}


static void
_wrap_PyZbr__tp_dealloc(PyZbr *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyZbr_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyZbr_wrapper_registry.end()) {
        PyZbr_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
    PyZbr__tp_clear(self);
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyZbr__tp_richcompare (PyZbr *PYBINDGEN_UNUSED(self), PyZbr *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyZbr_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyZbr_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.Zbr",            /* tp_name */
    sizeof(PyZbr),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyZbr__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PyZbr__tp_traverse,     /* tp_traverse */
    (inquiry)PyZbr__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PyZbr__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyZbr_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    offsetof(PyZbr, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PyZbr__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};




pybindgen::TypeMap PyZoo__typeid_map;

std::map<void*, PyObject*> PyZoo_wrapper_registry;


static int
_wrap_PyZoo__tp_init__0(PyZoo *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyZoo *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyZoo_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new Zoo(*((PyZoo *) arg0)->obj);
    return 0;
}

static int
_wrap_PyZoo__tp_init__1(PyZoo *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new Zoo();
    return 0;
}

static int
_wrap_PyZoo__tp_init__2(PyZoo *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *datum;
    Py_ssize_t datum_len;
    const char *keywords[] = {"datum", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s#", (char **) keywords, &datum, &datum_len)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new Zoo(std::string(datum, datum_len));
    return 0;
}

int _wrap_PyZoo__tp_init(PyZoo *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[3] = {0,};
    retval = _wrap_PyZoo__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyZoo__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    retval = _wrap_PyZoo__tp_init__2(self, args, kwargs, &exceptions[2]);
    if (!exceptions[2]) {
        Py_DECREF(exceptions[0]);
        Py_DECREF(exceptions[1]);
        return retval;
    }
    error_list = PyList_New(3);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyList_SET_ITEM(error_list, 2, PyObject_Str(exceptions[2]));
    Py_DECREF(exceptions[2]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyZoo_get_datum(PyZoo *self)
{
    PyObject *py_retval;
    std::string retval;
    
    retval = self->obj->get_datum();
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


static PyObject*
_wrap_PyZoo__copy__(PyZoo *self)
{

    PyZoo *py_copy;
    py_copy = PyObject_New(PyZoo, &PyZoo_Type);
    py_copy->obj = new Zoo(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyZoo_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyZoo_methods[] = {
    {(char *) "get_datum", (PyCFunction) _wrap_PyZoo_get_datum, METH_NOARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyZoo__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyZoo__tp_dealloc(PyZoo *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyZoo_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyZoo_wrapper_registry.end()) {
        PyZoo_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        Zoo *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyZoo__tp_richcompare (PyZoo *PYBINDGEN_UNUSED(self), PyZoo *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyZoo_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyZoo_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.Zoo",            /* tp_name */
    sizeof(PyZoo),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyZoo__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyZoo__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyZoo_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyZoo__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PyProperty__StdString_wrapper_registry;


static int
_wrap_PyProperty__StdString__tp_init__0(PyProperty__StdString *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyProperty__StdString *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyProperty__StdString_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new property< std::string >(*((PyProperty__StdString *) arg0)->obj);
    return 0;
}

static int
_wrap_PyProperty__StdString__tp_init__1(PyProperty__StdString *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new property< std::string >();
    return 0;
}

int _wrap_PyProperty__StdString__tp_init(PyProperty__StdString *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyProperty__StdString__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyProperty__StdString__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


static PyObject*
_wrap_PyProperty__StdString__copy__(PyProperty__StdString *self)
{

    PyProperty__StdString *py_copy;
    py_copy = PyObject_New(PyProperty__StdString, &PyProperty__StdString_Type);
    py_copy->obj = new property< std::string >(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyProperty__StdString_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyProperty__StdString_methods[] = {
    {(char *) "__copy__", (PyCFunction) _wrap_PyProperty__StdString__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyProperty__StdString__tp_dealloc(PyProperty__StdString *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyProperty__StdString_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyProperty__StdString_wrapper_registry.end()) {
        PyProperty__StdString_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        property< std::string > *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyProperty__StdString__tp_richcompare (PyProperty__StdString *PYBINDGEN_UNUSED(self), PyProperty__StdString *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyProperty__StdString_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyProperty__StdString_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.Property__StdString",            /* tp_name */
    sizeof(PyProperty__StdString),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyProperty__StdString__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyProperty__StdString__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyProperty__StdString_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyProperty__StdString__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};



std::map<void*, PyObject*> PySimple_struct_t_wrapper_registry;
static PyObject* _wrap_PySimple_struct_t__get_xpto(PySimple_struct_t *self, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "i", self->obj->xpto);
    return py_retval;
}
static int _wrap_PySimple_struct_t__set_xpto(PySimple_struct_t *self, PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &self->obj->xpto)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef PySimple_struct_t__getsets[] = {
    {
        (char*) "xpto", /* attribute name */
        (getter) _wrap_PySimple_struct_t__get_xpto, /* C function to get the attribute */
        (setter) _wrap_PySimple_struct_t__set_xpto, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    { NULL, NULL, NULL, NULL, NULL }
};


static int
_wrap_PySimple_struct_t__tp_init__0(PySimple_struct_t *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new simple_struct_t();
    return 0;
}

static int
_wrap_PySimple_struct_t__tp_init__1(PySimple_struct_t *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PySimple_struct_t *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PySimple_struct_t_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new simple_struct_t(*((PySimple_struct_t *) arg0)->obj);
    return 0;
}

int _wrap_PySimple_struct_t__tp_init(PySimple_struct_t *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PySimple_struct_t__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PySimple_struct_t__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


static PyObject*
_wrap_PySimple_struct_t__copy__(PySimple_struct_t *self)
{

    PySimple_struct_t *py_copy;
    py_copy = PyObject_New(PySimple_struct_t, &PySimple_struct_t_Type);
    py_copy->obj = new simple_struct_t(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PySimple_struct_t_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PySimple_struct_t_methods[] = {
    {(char *) "__copy__", (PyCFunction) _wrap_PySimple_struct_t__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PySimple_struct_t__tp_dealloc(PySimple_struct_t *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PySimple_struct_t_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PySimple_struct_t_wrapper_registry.end()) {
        PySimple_struct_t_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        simple_struct_t *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PySimple_struct_t__tp_richcompare (PySimple_struct_t *PYBINDGEN_UNUSED(self), PySimple_struct_t *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PySimple_struct_t_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PySimple_struct_t_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.Simple_struct_t",            /* tp_name */
    sizeof(PySimple_struct_t),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySimple_struct_t__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PySimple_struct_t__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PySimple_struct_t_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    PySimple_struct_t__getsets,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PySimple_struct_t__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};





static int
_wrap_PyMIBase1__tp_init__0(PyMIBase1 *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyMIBase1 *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyMIBase1_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new MIBase1(*((PyMIBase1 *) arg0)->obj);
    return 0;
}

static int
_wrap_PyMIBase1__tp_init__1(PyMIBase1 *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new MIBase1();
    return 0;
}

int _wrap_PyMIBase1__tp_init(PyMIBase1 *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyMIBase1__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyMIBase1__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyMIBase1_base1_method(PyMIBase1 *self)
{
    PyObject *py_retval;
    int retval;
    
    retval = self->obj->base1_method();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


static PyObject*
_wrap_PyMIBase1__copy__(PyMIBase1 *self)
{

    PyMIBase1 *py_copy;
    py_copy = PyObject_New(PyMIBase1, &PyMIBase1_Type);
    py_copy->obj = new MIBase1(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyMIRoot_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyMIBase1_methods[] = {
    {(char *) "base1_method", (PyCFunction) _wrap_PyMIBase1_base1_method, METH_NOARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyMIBase1__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyMIBase1__tp_dealloc(PyMIBase1 *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyMIRoot_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyMIRoot_wrapper_registry.end()) {
        PyMIRoot_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        MIBase1 *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyMIBase1__tp_richcompare (PyMIBase1 *PYBINDGEN_UNUSED(self), PyMIBase1 *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyMIBase1_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyMIBase1_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.MIBase1",            /* tp_name */
    sizeof(PyMIBase1),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyMIBase1__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyMIBase1__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyMIBase1_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyMIBase1__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};





static int
_wrap_PyMIBase2__tp_init__0(PyMIBase2 *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyMIBase2 *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyMIBase2_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new MIBase2(*((PyMIBase2 *) arg0)->obj);
    return 0;
}

static int
_wrap_PyMIBase2__tp_init__1(PyMIBase2 *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new MIBase2();
    return 0;
}

int _wrap_PyMIBase2__tp_init(PyMIBase2 *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyMIBase2__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyMIBase2__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyMIBase2_base2_method(PyMIBase2 *self)
{
    PyObject *py_retval;
    int retval;
    
    retval = self->obj->base2_method();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


static PyObject*
_wrap_PyMIBase2__copy__(PyMIBase2 *self)
{

    PyMIBase2 *py_copy;
    py_copy = PyObject_New(PyMIBase2, &PyMIBase2_Type);
    py_copy->obj = new MIBase2(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyMIRoot_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyMIBase2_methods[] = {
    {(char *) "base2_method", (PyCFunction) _wrap_PyMIBase2_base2_method, METH_NOARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyMIBase2__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyMIBase2__tp_dealloc(PyMIBase2 *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyMIRoot_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyMIRoot_wrapper_registry.end()) {
        PyMIRoot_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        MIBase2 *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyMIBase2__tp_richcompare (PyMIBase2 *PYBINDGEN_UNUSED(self), PyMIBase2 *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyMIBase2_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyMIBase2_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.MIBase2",            /* tp_name */
    sizeof(PyMIBase2),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyMIBase2__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyMIBase2__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyMIBase2_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyMIBase2__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};





static int
_wrap_PyMIMixed__tp_init__0(PyMIMixed *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyMIMixed *arg0;
    const char *keywords[] = {"arg0", NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyMIMixed_Type, &arg0)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new MIMixed(*((PyMIMixed *) arg0)->obj);
    return 0;
}

static int
_wrap_PyMIMixed__tp_init__1(PyMIMixed *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return -1;
    }
    self->obj = new MIMixed();
    return 0;
}

int _wrap_PyMIMixed__tp_init(PyMIMixed *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyMIMixed__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyMIMixed__tp_init__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return -1;
}


PyObject *
_wrap_PyMIMixed_mixed_method(PyMIMixed *self)
{
    PyObject *py_retval;
    int retval;
    
    retval = self->obj->mixed_method();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

PyObject *
_wrap_PyMIMixed_base1_method(PyMIMixed *self)
{
    PyObject *py_retval;
    int retval;
    
    retval = self->obj->base1_method();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_PyMIMixed_root_method__0(PyMIMixed *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    int retval;
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    retval = self->obj->root_method();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

PyObject *
_wrap_PyMIMixed_root_method__1(PyMIMixed *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    int retval;
    const char *keywords[] = {NULL};
    
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    retval = self->obj->root_method();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

PyObject * _wrap_PyMIMixed_root_method(PyMIMixed *self, PyObject *args, PyObject *kwargs)
{
    PyObject * retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyMIMixed_root_method__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyMIMixed_root_method__1(self, args, kwargs, &exceptions[1]);
    if (!exceptions[1]) {
        Py_DECREF(exceptions[0]);
        return retval;
    }
    error_list = PyList_New(2);
    PyList_SET_ITEM(error_list, 0, PyObject_Str(exceptions[0]));
    Py_DECREF(exceptions[0]);
    PyList_SET_ITEM(error_list, 1, PyObject_Str(exceptions[1]));
    Py_DECREF(exceptions[1]);
    PyErr_SetObject(PyExc_TypeError, error_list);
    Py_DECREF(error_list);
    return NULL;
}

PyObject *
_wrap_PyMIMixed_base2_method(PyMIMixed *self)
{
    PyObject *py_retval;
    int retval;
    
    retval = self->obj->base2_method();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


static PyObject*
_wrap_PyMIMixed__copy__(PyMIMixed *self)
{

    PyMIMixed *py_copy;
    py_copy = PyObject_New(PyMIMixed, &PyMIMixed_Type);
    py_copy->obj = new MIMixed(*self->obj);
    py_copy->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    PyMIRoot_wrapper_registry[(void *) py_copy->obj] = (PyObject *) py_copy;
    return (PyObject*) py_copy;
}

static PyMethodDef PyMIMixed_methods[] = {
    {(char *) "mixed_method", (PyCFunction) _wrap_PyMIMixed_mixed_method, METH_NOARGS, NULL },
    {(char *) "base1_method", (PyCFunction) _wrap_PyMIMixed_base1_method, METH_NOARGS, NULL },
    {(char *) "root_method", (PyCFunction) _wrap_PyMIMixed_root_method, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "base2_method", (PyCFunction) _wrap_PyMIMixed_base2_method, METH_NOARGS, NULL },
    {(char *) "__copy__", (PyCFunction) _wrap_PyMIMixed__copy__, METH_NOARGS, NULL},
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyMIMixed__tp_dealloc(PyMIMixed *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyMIRoot_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyMIRoot_wrapper_registry.end()) {
        PyMIRoot_wrapper_registry.erase(wrapper_lookup_iter);
    }
    
        MIMixed *tmp = self->obj;
        self->obj = NULL;
        if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
            delete tmp;
        }
    self->ob_type->tp_free((PyObject*)self);
}

static PyObject*
_wrap_PyMIMixed__tp_richcompare (PyMIMixed *PYBINDGEN_UNUSED(self), PyMIMixed *other, int opid)
{
    
    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyMIMixed_Type)) {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }
    switch (opid)
    {
    case Py_LT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_LE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_EQ:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_NE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GE:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    case Py_GT:
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    } /* closes switch (opid) */
    Py_INCREF(Py_NotImplemented);
    return Py_NotImplemented;
}

PyTypeObject PyMIMixed_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.MIMixed",            /* tp_name */
    sizeof(PyMIMixed),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyMIMixed__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)_wrap_PyMIMixed__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyMIMixed_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    0,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyMIMixed__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};




static void
PySimpleStructListIter__tp_clear(PySimpleStructListIter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

}


static int
PySimpleStructListIter__tp_traverse(PySimpleStructListIter *self, visitproc visit, void *arg)
{
    Py_VISIT((PyObject *) self->container);
    return 0;
}


static void
_wrap_PySimpleStructList__tp_dealloc(PySimpleStructList *self)
{
    delete self->obj;
    self->obj = NULL;

    self->ob_type->tp_free((PyObject*)self);
}


static void
_wrap_PySimpleStructListIter__tp_dealloc(PySimpleStructListIter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

    self->ob_type->tp_free((PyObject*)self);
}


static PyObject*
_wrap_PySimpleStructList__tp_iter(PySimpleStructList *self)
{
    PySimpleStructListIter *iter = PyObject_GC_New(PySimpleStructListIter, &PySimpleStructListIter_Type);
    Py_INCREF(self);
    iter->container = self;
    iter->iterator = new SimpleStructList::iterator(self->obj->begin());
    return (PyObject*) iter;
}


static PyObject*
_wrap_PySimpleStructListIter__tp_iter(PySimpleStructListIter *self)
{
    Py_INCREF(self);
    return (PyObject*) self;
}

static PyObject* _wrap_PySimpleStructListIter__tp_iternext(PySimpleStructListIter *self)
{
    PyObject *py_retval;
    SimpleStructList::iterator iter;
    PySimple_struct_t *py_simple_struct_t;
    
    iter = *self->iterator;
    if (iter == self->container->obj->end()) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    ++(*self->iterator);
    py_simple_struct_t = PyObject_New(PySimple_struct_t, &PySimple_struct_t_Type);
    py_simple_struct_t->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_simple_struct_t->obj = new simple_struct_t((*iter));
    PySimple_struct_t_wrapper_registry[(void *) py_simple_struct_t->obj] = (PyObject *) py_simple_struct_t;
    py_retval = Py_BuildValue((char *) "N", py_simple_struct_t);
    return py_retval;
}

int _wrap_convert_py2c__simple_struct_t(PyObject *value, simple_struct_t *address)
{
    PyObject *py_retval;
    PySimple_struct_t *tmp_simple_struct_t;
    
    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "O!", &PySimple_struct_t_Type, &tmp_simple_struct_t)) {
        Py_DECREF(py_retval);
        return 0;
    }
    *address = *tmp_simple_struct_t->obj;
    Py_DECREF(py_retval);
    return 1;
}


int _wrap_convert_py2c__SimpleStructList(PyObject *arg, SimpleStructList *container)
{
    if (PyObject_IsInstance(arg, (PyObject*) &PySimpleStructList_Type)) {
        *container = *((PySimpleStructList*)arg)->obj;
    } else if (PyList_Check(arg)) {
        container->clear();
        Py_ssize_t size = PyList_Size(arg);
        for (Py_ssize_t i = 0; i < size; i++) {
            simple_struct_t item;
            if (!_wrap_convert_py2c__simple_struct_t(PyList_GET_ITEM(arg, i), &item)) {
                return 0;
            }
            container->push_back(item);
        }
    } else {
        PyErr_SetString(PyExc_TypeError, "parameter must be None, a SimpleStructList instance, or a list of simple_struct_t");
        return 0;
    }
    return 1;
}


static int
_wrap_PySimpleStructList__tp_init(PySimpleStructList *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {"arg", NULL};
    PyObject *arg = NULL;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "|O", (char **) keywords, &arg)) {
        return -1;
    }

    self->obj = new SimpleStructList;

    if (arg == NULL)
        return 0;

    if (!_wrap_convert_py2c__SimpleStructList(arg, self->obj)) {
        delete self->obj;
        self->obj = NULL;
        return -1;
    }
    return 0;
}

PyTypeObject PySimpleStructList_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.SimpleStructList",            /* tp_name */
    sizeof(PySimpleStructList),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySimpleStructList__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_PySimpleStructList__tp_iter,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)NULL, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    NULL,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PySimpleStructList__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};

PyTypeObject PySimpleStructListIter_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.SimpleStructListIter",            /* tp_name */
    sizeof(PySimpleStructListIter),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySimpleStructListIter__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PySimpleStructListIter__tp_traverse,     /* tp_traverse */
    (inquiry)PySimpleStructListIter__tp_clear,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_PySimpleStructListIter__tp_iter,          /* tp_iter */
    (iternextfunc)_wrap_PySimpleStructListIter__tp_iternext,     /* tp_iternext */
    (struct PyMethodDef*)NULL, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    NULL,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)NULL,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};




static void
Pystd__vector__lt___simple_struct_t___gt__Iter__tp_clear(Pystd__vector__lt___simple_struct_t___gt__Iter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

}


static int
Pystd__vector__lt___simple_struct_t___gt__Iter__tp_traverse(Pystd__vector__lt___simple_struct_t___gt__Iter *self, visitproc visit, void *arg)
{
    Py_VISIT((PyObject *) self->container);
    return 0;
}


static void
_wrap_Pystd__vector__lt___simple_struct_t___gt____tp_dealloc(Pystd__vector__lt___simple_struct_t___gt__ *self)
{
    delete self->obj;
    self->obj = NULL;

    self->ob_type->tp_free((PyObject*)self);
}


static void
_wrap_Pystd__vector__lt___simple_struct_t___gt__Iter__tp_dealloc(Pystd__vector__lt___simple_struct_t___gt__Iter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

    self->ob_type->tp_free((PyObject*)self);
}


static PyObject*
_wrap_Pystd__vector__lt___simple_struct_t___gt____tp_iter(Pystd__vector__lt___simple_struct_t___gt__ *self)
{
    Pystd__vector__lt___simple_struct_t___gt__Iter *iter = PyObject_GC_New(Pystd__vector__lt___simple_struct_t___gt__Iter, &Pystd__vector__lt___simple_struct_t___gt__Iter_Type);
    Py_INCREF(self);
    iter->container = self;
    iter->iterator = new std::vector< simple_struct_t >::iterator(self->obj->begin());
    return (PyObject*) iter;
}


static PyObject*
_wrap_Pystd__vector__lt___simple_struct_t___gt__Iter__tp_iter(Pystd__vector__lt___simple_struct_t___gt__Iter *self)
{
    Py_INCREF(self);
    return (PyObject*) self;
}

static PyObject* _wrap_Pystd__vector__lt___simple_struct_t___gt__Iter__tp_iternext(Pystd__vector__lt___simple_struct_t___gt__Iter *self)
{
    PyObject *py_retval;
    std::vector< simple_struct_t >::iterator iter;
    PySimple_struct_t *py_simple_struct_t;
    
    iter = *self->iterator;
    if (iter == self->container->obj->end()) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    ++(*self->iterator);
    py_simple_struct_t = PyObject_New(PySimple_struct_t, &PySimple_struct_t_Type);
    py_simple_struct_t->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_simple_struct_t->obj = new simple_struct_t((*iter));
    PySimple_struct_t_wrapper_registry[(void *) py_simple_struct_t->obj] = (PyObject *) py_simple_struct_t;
    py_retval = Py_BuildValue((char *) "N", py_simple_struct_t);
    return py_retval;
}

int _wrap_convert_py2c__std__vector__lt___simple_struct_t___gt__(PyObject *arg, std::vector< simple_struct_t > *container)
{
    if (PyObject_IsInstance(arg, (PyObject*) &Pystd__vector__lt___simple_struct_t___gt___Type)) {
        *container = *((Pystd__vector__lt___simple_struct_t___gt__*)arg)->obj;
    } else if (PyList_Check(arg)) {
        container->clear();
        Py_ssize_t size = PyList_Size(arg);
        for (Py_ssize_t i = 0; i < size; i++) {
            simple_struct_t item;
            if (!_wrap_convert_py2c__simple_struct_t(PyList_GET_ITEM(arg, i), &item)) {
                return 0;
            }
            container->push_back(item);
        }
    } else {
        PyErr_SetString(PyExc_TypeError, "parameter must be None, a Std__vector__lt___simple_struct_t___gt__ instance, or a list of simple_struct_t");
        return 0;
    }
    return 1;
}


static int
_wrap_Pystd__vector__lt___simple_struct_t___gt____tp_init(Pystd__vector__lt___simple_struct_t___gt__ *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {"arg", NULL};
    PyObject *arg = NULL;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "|O", (char **) keywords, &arg)) {
        return -1;
    }

    self->obj = new std::vector< simple_struct_t >;

    if (arg == NULL)
        return 0;

    if (!_wrap_convert_py2c__std__vector__lt___simple_struct_t___gt__(arg, self->obj)) {
        delete self->obj;
        self->obj = NULL;
        return -1;
    }
    return 0;
}

PyTypeObject Pystd__vector__lt___simple_struct_t___gt___Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.Std__vector__lt___simple_struct_t___gt__",            /* tp_name */
    sizeof(Pystd__vector__lt___simple_struct_t___gt__),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_Pystd__vector__lt___simple_struct_t___gt____tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_Pystd__vector__lt___simple_struct_t___gt____tp_iter,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)NULL, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    NULL,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_Pystd__vector__lt___simple_struct_t___gt____tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};

PyTypeObject Pystd__vector__lt___simple_struct_t___gt__Iter_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.Std__vector__lt___simple_struct_t___gt__Iter",            /* tp_name */
    sizeof(Pystd__vector__lt___simple_struct_t___gt__Iter),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_Pystd__vector__lt___simple_struct_t___gt__Iter__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)Pystd__vector__lt___simple_struct_t___gt__Iter__tp_traverse,     /* tp_traverse */
    (inquiry)Pystd__vector__lt___simple_struct_t___gt__Iter__tp_clear,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_Pystd__vector__lt___simple_struct_t___gt__Iter__tp_iter,          /* tp_iter */
    (iternextfunc)_wrap_Pystd__vector__lt___simple_struct_t___gt__Iter__tp_iternext,     /* tp_iternext */
    (struct PyMethodDef*)NULL, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    NULL,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)NULL,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};




static void
PySimpleStructVecIter__tp_clear(PySimpleStructVecIter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

}


static int
PySimpleStructVecIter__tp_traverse(PySimpleStructVecIter *self, visitproc visit, void *arg)
{
    Py_VISIT((PyObject *) self->container);
    return 0;
}


static void
_wrap_PySimpleStructVec__tp_dealloc(PySimpleStructVec *self)
{
    delete self->obj;
    self->obj = NULL;

    self->ob_type->tp_free((PyObject*)self);
}


static void
_wrap_PySimpleStructVecIter__tp_dealloc(PySimpleStructVecIter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

    self->ob_type->tp_free((PyObject*)self);
}


static PyObject*
_wrap_PySimpleStructVec__tp_iter(PySimpleStructVec *self)
{
    PySimpleStructVecIter *iter = PyObject_GC_New(PySimpleStructVecIter, &PySimpleStructVecIter_Type);
    Py_INCREF(self);
    iter->container = self;
    iter->iterator = new SimpleStructVec::iterator(self->obj->begin());
    return (PyObject*) iter;
}


static PyObject*
_wrap_PySimpleStructVecIter__tp_iter(PySimpleStructVecIter *self)
{
    Py_INCREF(self);
    return (PyObject*) self;
}

static PyObject* _wrap_PySimpleStructVecIter__tp_iternext(PySimpleStructVecIter *self)
{
    PyObject *py_retval;
    SimpleStructVec::iterator iter;
    PySimple_struct_t *py_simple_struct_t;
    
    iter = *self->iterator;
    if (iter == self->container->obj->end()) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    ++(*self->iterator);
    py_simple_struct_t = PyObject_New(PySimple_struct_t, &PySimple_struct_t_Type);
    py_simple_struct_t->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_simple_struct_t->obj = new simple_struct_t((*iter));
    PySimple_struct_t_wrapper_registry[(void *) py_simple_struct_t->obj] = (PyObject *) py_simple_struct_t;
    py_retval = Py_BuildValue((char *) "N", py_simple_struct_t);
    return py_retval;
}

int _wrap_convert_py2c__SimpleStructVec(PyObject *arg, SimpleStructVec *container)
{
    if (PyObject_IsInstance(arg, (PyObject*) &PySimpleStructVec_Type)) {
        *container = *((PySimpleStructVec*)arg)->obj;
    } else if (PyList_Check(arg)) {
        container->clear();
        Py_ssize_t size = PyList_Size(arg);
        for (Py_ssize_t i = 0; i < size; i++) {
            simple_struct_t item;
            if (!_wrap_convert_py2c__simple_struct_t(PyList_GET_ITEM(arg, i), &item)) {
                return 0;
            }
            container->push_back(item);
        }
    } else {
        PyErr_SetString(PyExc_TypeError, "parameter must be None, a SimpleStructVec instance, or a list of simple_struct_t");
        return 0;
    }
    return 1;
}


static int
_wrap_PySimpleStructVec__tp_init(PySimpleStructVec *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {"arg", NULL};
    PyObject *arg = NULL;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "|O", (char **) keywords, &arg)) {
        return -1;
    }

    self->obj = new SimpleStructVec;

    if (arg == NULL)
        return 0;

    if (!_wrap_convert_py2c__SimpleStructVec(arg, self->obj)) {
        delete self->obj;
        self->obj = NULL;
        return -1;
    }
    return 0;
}

PyTypeObject PySimpleStructVec_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.SimpleStructVec",            /* tp_name */
    sizeof(PySimpleStructVec),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySimpleStructVec__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_PySimpleStructVec__tp_iter,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)NULL, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    NULL,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PySimpleStructVec__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};

PyTypeObject PySimpleStructVecIter_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.SimpleStructVecIter",            /* tp_name */
    sizeof(PySimpleStructVecIter),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySimpleStructVecIter__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PySimpleStructVecIter__tp_traverse,     /* tp_traverse */
    (inquiry)PySimpleStructVecIter__tp_clear,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_PySimpleStructVecIter__tp_iter,          /* tp_iter */
    (iternextfunc)_wrap_PySimpleStructVecIter__tp_iternext,     /* tp_iternext */
    (struct PyMethodDef*)NULL, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    NULL,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)NULL,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};




static void
PySimpleStructMapIter__tp_clear(PySimpleStructMapIter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

}


static int
PySimpleStructMapIter__tp_traverse(PySimpleStructMapIter *self, visitproc visit, void *arg)
{
    Py_VISIT((PyObject *) self->container);
    return 0;
}


static void
_wrap_PySimpleStructMap__tp_dealloc(PySimpleStructMap *self)
{
    delete self->obj;
    self->obj = NULL;

    self->ob_type->tp_free((PyObject*)self);
}


static void
_wrap_PySimpleStructMapIter__tp_dealloc(PySimpleStructMapIter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

    self->ob_type->tp_free((PyObject*)self);
}


static PyObject*
_wrap_PySimpleStructMap__tp_iter(PySimpleStructMap *self)
{
    PySimpleStructMapIter *iter = PyObject_GC_New(PySimpleStructMapIter, &PySimpleStructMapIter_Type);
    Py_INCREF(self);
    iter->container = self;
    iter->iterator = new SimpleStructMap::iterator(self->obj->begin());
    return (PyObject*) iter;
}


static PyObject*
_wrap_PySimpleStructMapIter__tp_iter(PySimpleStructMapIter *self)
{
    Py_INCREF(self);
    return (PyObject*) self;
}

static PyObject* _wrap_PySimpleStructMapIter__tp_iternext(PySimpleStructMapIter *self)
{
    PyObject *py_retval;
    SimpleStructMap::iterator iter;
    PySimple_struct_t *py_simple_struct_t;
    
    iter = *self->iterator;
    if (iter == self->container->obj->end()) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    ++(*self->iterator);
    py_simple_struct_t = PyObject_New(PySimple_struct_t, &PySimple_struct_t_Type);
    py_simple_struct_t->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_simple_struct_t->obj = new simple_struct_t(iter->second);
    PySimple_struct_t_wrapper_registry[(void *) py_simple_struct_t->obj] = (PyObject *) py_simple_struct_t;
    py_retval = Py_BuildValue((char *) "s#N", (iter->first).c_str(), (iter->first).size(), py_simple_struct_t);
    return py_retval;
}

int _wrap_convert_py2c__SimpleStructMap(PyObject *arg, SimpleStructMap *container)
{
    if (PyObject_IsInstance(arg, (PyObject*) &PySimpleStructMap_Type)) {
        *container = *((PySimpleStructMap*)arg)->obj;
    } else if (PyList_Check(arg)) {
        container->clear();
        Py_ssize_t size = PyList_Size(arg);
        for (Py_ssize_t i = 0; i < size; i++) {
            PyObject *tup = PyList_GET_ITEM(arg, i);
            if (!PyTuple_Check(tup) || PyTuple_Size(tup) != 2) {
                PyErr_SetString(PyExc_TypeError, "items must be tuples with two elements");
                return 0;
            }
            std::pair<std::string, simple_struct_t> item;
            if (!_wrap_convert_py2c__std__string(PyTuple_GET_ITEM(tup, 0), &item.first)) {
                return 0;
            }
            if (!_wrap_convert_py2c__simple_struct_t(PyTuple_GET_ITEM(tup, 1), &item.second)) {
                return 0;
            }
            container->insert(item);
        }
    } else {
        PyErr_SetString(PyExc_TypeError, "parameter must be None, a SimpleStructMap instance, or a list of simple_struct_t");
        return 0;
    }
    return 1;
}


static int
_wrap_PySimpleStructMap__tp_init(PySimpleStructMap *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {"arg", NULL};
    PyObject *arg = NULL;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "|O", (char **) keywords, &arg)) {
        return -1;
    }

    self->obj = new SimpleStructMap;

    if (arg == NULL)
        return 0;

    if (!_wrap_convert_py2c__SimpleStructMap(arg, self->obj)) {
        delete self->obj;
        self->obj = NULL;
        return -1;
    }
    return 0;
}

PyTypeObject PySimpleStructMap_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.SimpleStructMap",            /* tp_name */
    sizeof(PySimpleStructMap),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySimpleStructMap__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)NULL,     /* tp_traverse */
    (inquiry)NULL,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_PySimpleStructMap__tp_iter,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)NULL, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    NULL,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PySimpleStructMap__tp_init,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};

PyTypeObject PySimpleStructMapIter_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo4.SimpleStructMapIter",            /* tp_name */
    sizeof(PySimpleStructMapIter),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PySimpleStructMapIter__tp_dealloc,        /* tp_dealloc */
    (printfunc)0,                      /* tp_print */
    (getattrfunc)NULL,       /* tp_getattr */
    (setattrfunc)NULL,       /* tp_setattr */
    (cmpfunc)NULL,           /* tp_compare */
    (reprfunc)NULL,             /* tp_repr */
    (PyNumberMethods*)NULL,     /* tp_as_number */
    (PySequenceMethods*)NULL, /* tp_as_sequence */
    (PyMappingMethods*)NULL,   /* tp_as_mapping */
    (hashfunc)NULL,             /* tp_hash */
    (ternaryfunc)NULL,          /* tp_call */
    (reprfunc)NULL,              /* tp_str */
    (getattrofunc)NULL,     /* tp_getattro */
    (setattrofunc)NULL,     /* tp_setattro */
    (PyBufferProcs*)NULL,  /* tp_as_buffer */
    Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC,                      /* tp_flags */
    NULL,                        /* Documentation string */
    (traverseproc)PySimpleStructMapIter__tp_traverse,     /* tp_traverse */
    (inquiry)PySimpleStructMapIter__tp_clear,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_PySimpleStructMapIter__tp_iter,          /* tp_iter */
    (iternextfunc)_wrap_PySimpleStructMapIter__tp_iternext,     /* tp_iternext */
    (struct PyMethodDef*)NULL, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    NULL,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)NULL,             /* tp_init */
    (allocfunc)PyType_GenericAlloc,           /* tp_alloc */
    (newfunc)PyType_GenericNew,               /* tp_new */
    (freefunc)0,             /* tp_free */
    (inquiry)NULL,             /* tp_is_gc */
    NULL,                              /* tp_bases */
    NULL,                              /* tp_mro */
    NULL,                              /* tp_cache */
    NULL,                              /* tp_subclasses */
    NULL,                              /* tp_weaklist */
    (destructor) NULL                  /* tp_del */
};








