/* This file was generated by PyBindGen 0.15.0 */
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <stddef.h>


#if PY_VERSION_HEX < 0x020400F0

#define PyEval_ThreadsInitialized() 1

#define Py_CLEAR(op)				\
        do {                            	\
                if (op) {			\
                        PyObject *tmp = (PyObject *)(op);	\
                        (op) = NULL;		\
                        Py_DECREF(tmp);		\
                }				\
        } while (0)


#define Py_VISIT(op)							\
        do { 								\
                if (op) {						\
                        int vret = visit((PyObject *)(op), arg);	\
                        if (vret)					\
                                return vret;				\
                }							\
        } while (0)

#endif



#if PY_VERSION_HEX < 0x020500F0

typedef int Py_ssize_t;
# define PY_SSIZE_T_MAX INT_MAX
# define PY_SSIZE_T_MIN INT_MIN
typedef inquiry lenfunc;
typedef intargfunc ssizeargfunc;
typedef intobjargproc ssizeobjargproc;

#endif


#if     __GNUC__ > 2
# define PYBINDGEN_UNUSED(param) param __attribute__((__unused__))
#elif     __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
# define PYBINDGEN_UNUSED(param) __attribute__((__unused__)) param
#else
# define PYBINDGEN_UNUSED(param) param
#endif  /* !__GNUC__ */

typedef enum _PyBindGenWrapperFlags {
   PYBINDGEN_WRAPPER_FLAG_NONE = 0,
   PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED = (1<<0),
} PyBindGenWrapperFlags;


#include "foo.h"
#include <ostream>
#include <sstream>
#include <typeinfo>
#include <map>
#include <iostream>
/* --- forward declarations --- */


typedef struct {
    PyObject_HEAD
    Foo *obj;
    PyBindGenWrapperFlags flags:8;
} PyFoo;


extern PyTypeObject PyFoo_Type;
extern PyTypeObject PyFooMeta_Type;



#include <map>
#include <typeinfo>
#if defined(__GNUC__) && __GNUC__ >= 3
# include <cxxabi.h>
#endif

namespace pybindgen {

class TypeMap
{
   std::map<const char *, PyTypeObject *> m_map;

public:

   TypeMap() {}

   void register_wrapper(const std::type_info &cpp_type_info, PyTypeObject *python_wrapper)
   {
       m_map[cpp_type_info.name()] = python_wrapper;
   }

   PyTypeObject * lookup_wrapper(const std::type_info &cpp_type_info, PyTypeObject *fallback_wrapper)
   {
       PyTypeObject *python_wrapper = m_map[cpp_type_info.name()];
       if (python_wrapper)
           return python_wrapper;
       else {
#if defined(__GNUC__) && __GNUC__ >= 3

           // Get closest (in the single inheritance tree provided by cxxabi.h)
           // registered python wrapper.
           const abi::__si_class_type_info *_typeinfo =
               dynamic_cast<const abi::__si_class_type_info*> (&cpp_type_info);
           while (_typeinfo && (python_wrapper = m_map[_typeinfo->name()]) == 0)
               _typeinfo = dynamic_cast<const abi::__si_class_type_info*> (_typeinfo->__base_type);

           return python_wrapper? python_wrapper : fallback_wrapper;

#else // non gcc 3+ compilers can only match against explicitly registered classes, not hidden subclasses
           return fallback_wrapper;
#endif
       }
   }
};

}


extern pybindgen::TypeMap PyFoo__typeid_map;

extern std::map<void*, PyObject*> PyFoo_wrapper_registry;

typedef struct {
    PyObject_HEAD
    Zoo *obj;
    PyBindGenWrapperFlags flags:8;
} PyZoo;


extern PyTypeObject PyZoo_Type;


extern pybindgen::TypeMap PyZoo__typeid_map;

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

typedef struct {
    PyObject_HEAD
    Foobar *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PyFoobar;


extern PyTypeObject PyFoobar_Type;
extern PyTypeObject PyFoobarMeta_Type;

extern std::map<void*, PyObject*> PyFoobar_wrapper_registry;

typedef struct {
    PyObject_HEAD
    Bar *obj;
    PyBindGenWrapperFlags flags:8;
} PyBar;


extern PyTypeObject PyBar_Type;


typedef struct {
    PyObject_HEAD
    Zbr *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PyZbr;


extern PyTypeObject PyZbr_Type;
extern PyTypeObject PyZbrMeta_Type;

class PyZbr__PythonHelper : public Zbr
{
public:
    PyObject *m_pyself;
    PyZbr__PythonHelper()
        : Zbr(), m_pyself(NULL)
        {}

    PyZbr__PythonHelper(std::string datum)
        : Zbr(datum), m_pyself(NULL)
        {}


    void set_pyobj(PyObject *pyobj)
    {
        Py_XDECREF(m_pyself);
        Py_INCREF(pyobj);
        m_pyself = pyobj;
    }

    virtual ~PyZbr__PythonHelper()
    {
        Py_CLEAR(m_pyself);
    }


    virtual int get_int(int x);
    static int custom_method_added_by_a_hook(int x);
};

// this comment was written by a helper class hook function

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

typedef struct {
    PyObject_HEAD
    SomeObject *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PySomeObject;


extern PyTypeObject PySomeObject_Type;
extern PyTypeObject PySomeObjectMeta_Type;

class PySomeObject__PythonHelper : public SomeObject
{
public:
    PyObject *m_pyself;
    PySomeObject__PythonHelper(std::string prefix)
        : SomeObject(prefix), m_pyself(NULL)
        {}

    PySomeObject__PythonHelper(int prefix_len)
        : SomeObject(prefix_len), m_pyself(NULL)
        {}


    void set_pyobj(PyObject *pyobj)
    {
        Py_XDECREF(m_pyself);
        Py_INCREF(pyobj);
        m_pyself = pyobj;
    }

    virtual ~PySomeObject__PythonHelper()
    {
        Py_CLEAR(m_pyself);
    }


    static PyObject * _wrap_protected_method_that_is_not_virtual(PySomeObject *self, PyObject *args, PyObject *kwargs);
    inline std::string protected_method_that_is_not_virtual__parent_caller(std::string arg)
    { return SomeObject::protected_method_that_is_not_virtual(arg); }

    virtual std::string get_prefix() const;

    virtual std::string get_prefix_with_foo_value(Foo foo) const;

    virtual std::string get_prefix_with_foo_ref(Foo const & foo) const;

    virtual std::string get_prefix_with_foo_ptr(Foo const *foo) const;

    virtual std::string get_something() const;

    virtual std::string get_something(int x) const;

    virtual void set_pyobject(PyObject *pyobject);

    virtual PyObject * get_pyobject();
};

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

typedef struct {
    PyObject_HEAD
    ClassThatTakesFoo *obj;
    PyBindGenWrapperFlags flags:8;
} PyClassThatTakesFoo;


extern PyTypeObject PyClassThatTakesFoo_Type;

extern std::map<void*, PyObject*> PyClassThatTakesFoo_wrapper_registry;

typedef struct {
    PyObject_HEAD
    SingletonClass *obj;
    PyBindGenWrapperFlags flags:8;
} PySingletonClass;


extern PyTypeObject PySingletonClass_Type;

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

typedef struct {
    PyObject_HEAD
    InterfaceId *obj;
    PyBindGenWrapperFlags flags:8;
} PyInterfaceId;


extern PyTypeObject PyInterfaceId_Type;

extern std::map<void*, PyObject*> PyInterfaceId_wrapper_registry;

typedef struct {
    PyObject_HEAD
    CannotBeConstructed *obj;
    PyBindGenWrapperFlags flags:8;
} PyCannotBeConstructed;


extern PyTypeObject PyCannotBeConstructed_Type;

extern std::map<void*, PyObject*> PyCannotBeConstructed_wrapper_registry;

typedef struct {
    PyObject_HEAD
    SomeObject::NestedClass *obj;
    PyBindGenWrapperFlags flags:8;
} PySomeObjectNestedClass;


extern PyTypeObject PySomeObjectNestedClass_Type;
extern PyTypeObject PySomeObjectNestedClassMeta_Type;


extern pybindgen::TypeMap PySomeObjectNestedClass__typeid_map;

extern std::map<void*, PyObject*> PySomeObjectNestedClass_wrapper_registry;

typedef struct {
    PyObject_HEAD
    AbstractBaseClass2 *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PyAbstractBaseClass2;


extern PyTypeObject PyAbstractBaseClass2_Type;

class PyAbstractBaseClass2__PythonHelper : public AbstractBaseClass2
{
public:
    PyObject *m_pyself;
    PyAbstractBaseClass2__PythonHelper()
        : AbstractBaseClass2(), m_pyself(NULL)
        {}


    void set_pyobj(PyObject *pyobj)
    {
        Py_XDECREF(m_pyself);
        Py_INCREF(pyobj);
        m_pyself = pyobj;
    }

    virtual ~PyAbstractBaseClass2__PythonHelper()
    {
        Py_CLEAR(m_pyself);
    }


    static PyObject * _wrap_protected_virtual(PyAbstractBaseClass2 *self, PyObject *args, PyObject *kwargs);
    inline int protected_virtual__parent_caller(int x)
    { return AbstractBaseClass2::protected_virtual(x); }

    virtual int protected_virtual(int x) const;

    virtual int protected_pure_virtual(int x) const;

    virtual int private_virtual(int x) const;
};

extern std::map<void*, PyObject*> PyAbstractBaseClass2_wrapper_registry;

typedef struct {
    PyObject_HEAD
    AbstractXpto *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PyAbstractXpto;


extern PyTypeObject PyAbstractXpto_Type;

class PyAbstractXpto__PythonHelper : public AbstractXpto
{
public:
    PyObject *m_pyself;
    PyAbstractXpto__PythonHelper()
        : AbstractXpto(), m_pyself(NULL)
        {}


    void set_pyobj(PyObject *pyobj)
    {
        Py_XDECREF(m_pyself);
        Py_INCREF(pyobj);
        m_pyself = pyobj;
    }

    virtual ~PyAbstractXpto__PythonHelper()
    {
        Py_CLEAR(m_pyself);
    }


    virtual void something(int x) const;
};

extern std::map<void*, PyObject*> PyAbstractXpto_wrapper_registry;

typedef struct {
    PyObject_HEAD
    AbstractXptoImpl *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PyAbstractXptoImpl;


extern PyTypeObject PyAbstractXptoImpl_Type;

class PyAbstractXptoImpl__PythonHelper : public AbstractXptoImpl
{
public:
    PyObject *m_pyself;
    PyAbstractXptoImpl__PythonHelper()
        : AbstractXptoImpl(), m_pyself(NULL)
        {}


    void set_pyobj(PyObject *pyobj)
    {
        Py_XDECREF(m_pyself);
        Py_INCREF(pyobj);
        m_pyself = pyobj;
    }

    virtual ~PyAbstractXptoImpl__PythonHelper()
    {
        Py_CLEAR(m_pyself);
    }


    virtual void something(int x) const;
};


typedef struct {
    PyObject_HEAD
    Word *obj;
    PyBindGenWrapperFlags flags:8;
} PyWord;


extern PyTypeObject PyWord_Type;

extern std::map<void*, PyObject*> PyWord_wrapper_registry;

typedef struct {
    PyObject_HEAD
    Socket *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PySocket;


extern PyTypeObject PySocket_Type;

class PySocket__PythonHelper : public Socket
{
public:
    PyObject *m_pyself;
    PySocket__PythonHelper()
        : Socket(), m_pyself(NULL)
        {}


    void set_pyobj(PyObject *pyobj)
    {
        Py_XDECREF(m_pyself);
        Py_INCREF(pyobj);
        m_pyself = pyobj;
    }

    virtual ~PySocket__PythonHelper()
    {
        Py_CLEAR(m_pyself);
    }


    virtual int Bind();

    virtual int Bind(int address);
};

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

typedef struct {
    PyObject_HEAD
    UdpSocket *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PyUdpSocket;


extern PyTypeObject PyUdpSocket_Type;

class PyUdpSocket__PythonHelper : public UdpSocket
{
public:
    PyObject *m_pyself;
    PyUdpSocket__PythonHelper()
        : UdpSocket(), m_pyself(NULL)
        {}


    void set_pyobj(PyObject *pyobj)
    {
        Py_XDECREF(m_pyself);
        Py_INCREF(pyobj);
        m_pyself = pyobj;
    }

    virtual ~PyUdpSocket__PythonHelper()
    {
        Py_CLEAR(m_pyself);
    }


    virtual int Bind();

    virtual int Bind(int address);
};


typedef struct {
    PyObject_HEAD
    simple_struct_t *obj;
    PyBindGenWrapperFlags flags:8;
} PySimple_struct_t;


extern PyTypeObject PySimple_struct_t_Type;

extern std::map<void*, PyObject*> PySimple_struct_t_wrapper_registry;

typedef struct {
    PyObject_HEAD
    TestContainer *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PyTestContainer;


extern PyTypeObject PyTestContainer_Type;

class PyTestContainer__PythonHelper : public TestContainer
{
public:
    PyObject *m_pyself;
    PyTestContainer__PythonHelper()
        : TestContainer(), m_pyself(NULL)
        {}


    void set_pyobj(PyObject *pyobj)
    {
        Py_XDECREF(m_pyself);
        Py_INCREF(pyobj);
        m_pyself = pyobj;
    }

    virtual ~PyTestContainer__PythonHelper()
    {
        Py_CLEAR(m_pyself);
    }


    virtual SimpleStructList get_simple_list();

    virtual int set_simple_list(SimpleStructList list);

    virtual int set_simple_list_by_ref(SimpleStructList & inout_list);

    virtual std::vector< simple_struct_t > get_simple_vec();

    virtual int set_simple_vec(std::vector< simple_struct_t > vec);

    virtual std::map< std::string, simple_struct_t > get_simple_map();

    virtual int set_simple_map(std::map< std::string, simple_struct_t > map);
};

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

typedef struct {
    PyObject_HEAD
    Tupl *obj;
    PyBindGenWrapperFlags flags:8;
} PyTupl;


extern PyTypeObject PyTupl_Type;

extern std::map<void*, PyObject*> PyTupl_wrapper_registry;

typedef struct {
    PyObject_HEAD
    ManipulatedObject *obj;
    PyBindGenWrapperFlags flags:8;
} PyManipulatedObject;


extern PyTypeObject PyManipulatedObject_Type;

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

typedef struct {
    PyObject_HEAD
    ReferenceManipulator *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PyReferenceManipulator;


extern PyTypeObject PyReferenceManipulator_Type;

class PyReferenceManipulator__PythonHelper : public ReferenceManipulator
{
public:
    PyObject *m_pyself;
    PyReferenceManipulator__PythonHelper()
        : ReferenceManipulator(), m_pyself(NULL)
        {}


    void set_pyobj(PyObject *pyobj)
    {
        Py_XDECREF(m_pyself);
        Py_INCREF(pyobj);
        m_pyself = pyobj;
    }

    virtual ~PyReferenceManipulator__PythonHelper()
    {
        Py_CLEAR(m_pyself);
    }


    virtual void do_manipulate_object(ManipulatedObject & obj);
};

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

typedef struct {
    PyObject_HEAD
    VectorLike *obj;
    PyBindGenWrapperFlags flags:8;
} PyVectorLike;


extern PyTypeObject PyVectorLike_Type;

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

typedef struct {
    PyObject_HEAD
    VectorLike2 *obj;
    PyBindGenWrapperFlags flags:8;
} PyVectorLike2;


extern PyTypeObject PyVectorLike2_Type;


typedef struct {
    PyObject_HEAD
    PyVectorLike2 *container;
    VectorLike2::Iterator *iterator;
} PyVectorLike2_Iter;


extern PyTypeObject PyVectorLike2_IterType;

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

typedef struct {
    PyObject_HEAD
    MapLike *obj;
    PyBindGenWrapperFlags flags:8;
} PyMapLike;


extern PyTypeObject PyMapLike_Type;


typedef struct {
    PyObject_HEAD
    PyMapLike *container;
    MapLike::Iterator *iterator;
} PyMapLike_Iter;


extern PyTypeObject PyMapLike_IterType;

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

typedef struct {
    PyObject_HEAD
    ClassThatThrows *obj;
    PyObject *inst_dict;
    PyBindGenWrapperFlags flags:8;
} PyClassThatThrows;


extern PyTypeObject PyClassThatThrows_Type;

class PyClassThatThrows__PythonHelper : public ClassThatThrows
{
public:
    PyObject *m_pyself;
    PyClassThatThrows__PythonHelper(double x)
        : ClassThatThrows(x), m_pyself(NULL)
        {}


    void set_pyobj(PyObject *pyobj)
    {
        Py_XDECREF(m_pyself);
        Py_INCREF(pyobj);
        m_pyself = pyobj;
    }

    virtual ~PyClassThatThrows__PythonHelper()
    {
        Py_CLEAR(m_pyself);
    }


    virtual int throw_error() const throw (std::exception);
};

extern std::map<void*, PyObject*> PyClassThatThrows_wrapper_registry;

typedef struct {
    PyObject_HEAD
    ProtectedConstructor *obj;
    PyBindGenWrapperFlags flags:8;
} PyProtectedConstructor;


extern PyTypeObject PyProtectedConstructor_Type;

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

typedef struct {
    PyObject_HEAD
    property< std::string > *obj;
    PyBindGenWrapperFlags flags:8;
} PyProperty__StdString;


extern PyTypeObject PyProperty__StdString_Type;

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

typedef struct {
    PyObject_HEAD
    Box *obj;
    PyBindGenWrapperFlags flags:8;
} PyBox;


extern PyTypeObject PyBox_Type;
extern PyTypeObject PyBoxMeta_Type;

extern std::map<void*, PyObject*> PyBox_wrapper_registry;

typedef struct {
    PyObject_HEAD
    MIRoot *obj;
    PyBindGenWrapperFlags flags:8;
} PyMIRoot;


extern PyTypeObject PyMIRoot_Type;

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

typedef struct {
    PyObject_HEAD
    MIBase1 *obj;
    PyBindGenWrapperFlags flags:8;
} PyMIBase1;


extern PyTypeObject PyMIBase1_Type;


typedef struct {
    PyObject_HEAD
    MIBase2 *obj;
    PyBindGenWrapperFlags flags:8;
} PyMIBase2;


extern PyTypeObject PyMIBase2_Type;


typedef struct {
    PyObject_HEAD
    MIMixed *obj;
    PyBindGenWrapperFlags flags:8;
} PyMIMixed;


extern PyTypeObject PyMIMixed_Type;


typedef struct {
    PyObject_HEAD
    SimpleStructList *obj;
} PySimpleStructList;


typedef struct {
    PyObject_HEAD
    PySimpleStructList *container;
    SimpleStructList::iterator *iterator;
} PySimpleStructListIter;


extern PyTypeObject PySimpleStructList_Type;
extern PyTypeObject PySimpleStructListIter_Type;

int _wrap_convert_py2c__SimpleStructList(PyObject *arg, SimpleStructList *container);

typedef struct {
    PyObject_HEAD
    std::set<float> *obj;
} Pystd__set__lt__float__gt__;


typedef struct {
    PyObject_HEAD
    Pystd__set__lt__float__gt__ *container;
    std::set<float>::iterator *iterator;
} Pystd__set__lt__float__gt__Iter;


extern PyTypeObject Pystd__set__lt__float__gt___Type;
extern PyTypeObject Pystd__set__lt__float__gt__Iter_Type;

int _wrap_convert_py2c__std__set__lt___float___gt__(PyObject *arg, std::set<float> *container);

typedef struct {
    PyObject_HEAD
    std::vector<simple_struct_t> *obj;
} Pystd__vector__lt__simple_struct_t__gt__;


typedef struct {
    PyObject_HEAD
    Pystd__vector__lt__simple_struct_t__gt__ *container;
    std::vector<simple_struct_t>::iterator *iterator;
} Pystd__vector__lt__simple_struct_t__gt__Iter;


extern PyTypeObject Pystd__vector__lt__simple_struct_t__gt___Type;
extern PyTypeObject Pystd__vector__lt__simple_struct_t__gt__Iter_Type;

int _wrap_convert_py2c__std__vector__lt___simple_struct_t___gt__(PyObject *arg, std::vector<simple_struct_t> *container);

typedef struct {
    PyObject_HEAD
    std::vector<std::string> *obj;
} Pystd__vector__lt__std__string__gt__;


typedef struct {
    PyObject_HEAD
    Pystd__vector__lt__std__string__gt__ *container;
    std::vector<std::string>::iterator *iterator;
} Pystd__vector__lt__std__string__gt__Iter;


extern PyTypeObject Pystd__vector__lt__std__string__gt___Type;
extern PyTypeObject Pystd__vector__lt__std__string__gt__Iter_Type;

int _wrap_convert_py2c__std__vector__lt___std__string___gt__(PyObject *arg, std::vector<std::string> *container);

typedef struct {
    PyObject_HEAD
    std::map<std::string, simple_struct_t> *obj;
} Pystd__map__lt__std__string__simple_struct_t__gt__;


typedef struct {
    PyObject_HEAD
    Pystd__map__lt__std__string__simple_struct_t__gt__ *container;
    std::map<std::string, simple_struct_t>::iterator *iterator;
} Pystd__map__lt__std__string__simple_struct_t__gt__Iter;


extern PyTypeObject Pystd__map__lt__std__string__simple_struct_t__gt___Type;
extern PyTypeObject Pystd__map__lt__std__string__simple_struct_t__gt__Iter_Type;

int _wrap_convert_py2c__std__map__lt___std__string__simple_struct_t___gt__(PyObject *arg, std::map<std::string, simple_struct_t> *container);

extern PyTypeObject *PyError_Type;


extern PyTypeObject *PyDomainError_Type;


extern PyTypeObject *Pystd__exception_Type;

/* --- forward declarations --- */


typedef struct {
    PyObject_HEAD
    xpto::SomeClass *obj;
    PyBindGenWrapperFlags flags:8;
} PyXptoSomeClass;


extern PyTypeObject PyXptoSomeClass_Type;

extern std::map<void*, PyObject*> PyXptoSomeClass_wrapper_registry;
/* --- forward declarations --- */


typedef struct {
    PyObject_HEAD
    TopNs::OuterBase *obj;
    PyBindGenWrapperFlags flags:8;
} PyTopNsOuterBase;


extern PyTypeObject PyTopNsOuterBase_Type;

extern std::map<void*, PyObject*> PyTopNsOuterBase_wrapper_registry;
/* --- forward declarations --- */


typedef struct {
    PyObject_HEAD
    TopNs::PrefixBottomNs::PrefixInner *obj;
    PyBindGenWrapperFlags flags:8;
} PyTopNsPrefixBottomNsPrefixInner;


extern PyTypeObject PyTopNsPrefixBottomNsPrefixInner_Type;


PyObject* _wrap_convert_c2py__Tupl(Tupl *cvalue);


int _wrap_convert_py2c__Tupl(PyObject *value, Tupl *address);


int _wrap_convert_py2c__int(PyObject *value, int *address);


int _wrap_convert_py2c__VectorLike(PyObject *value, VectorLike *address);


int _wrap_convert_py2c__simple_struct_t(PyObject *value, simple_struct_t *address);


int _wrap_convert_py2c__float(PyObject *value, float *address);


int _wrap_convert_py2c__std__string(PyObject *value, std::string *address);

/* --- module functions --- */


PyObject *
_wrap_foo_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_foo_xptoset_foo_type_ptr(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foo_xptoget_foo_datum(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    std::string 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;
    }
    retval = xpto::get_foo_datum(foo2);
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}
PyObject * _wrap_foo_xptoget_foo_datum(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foo_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_foo_xptosome_function();


PyObject *
_wrap_foo_xptoget_foo_type()
{
    PyObject *py_retval;
    xpto::FooType retval;

    retval = xpto::get_foo_type();
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}
PyObject * _wrap_foo_xptoget_foo_type();


PyObject *
_wrap_foo_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;
}
PyObject * _wrap_foo_xptoset_foo_type_inout(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foo_xptoget_flow_id(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    xpto::FlowId retval;
    unsigned int flowId;
    const char *keywords[] = {"flowId", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "I", (char **) keywords, &flowId)) {
        return NULL;
    }
    retval = xpto::get_flow_id(flowId);
    py_retval = Py_BuildValue((char *) "N", PyLong_FromUnsignedLong(retval));
    return py_retval;
}
PyObject * _wrap_foo_xptoget_flow_id(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foo_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_foo_xptoset_foo_type(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);

static PyMethodDef foo_xpto_functions[] = {
    {(char *) "set_foo_type_ptr", (PyCFunction) _wrap_foo_xptoset_foo_type_ptr, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_foo_datum", (PyCFunction) _wrap_foo_xptoget_foo_datum, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "some_function", (PyCFunction) _wrap_foo_xptosome_function, METH_NOARGS, NULL },
    {(char *) "get_foo_type", (PyCFunction) _wrap_foo_xptoget_foo_type, METH_NOARGS, NULL },
    {(char *) "set_foo_type_inout", (PyCFunction) _wrap_foo_xptoset_foo_type_inout, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_flow_id", (PyCFunction) _wrap_foo_xptoget_flow_id, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "set_foo_type", (PyCFunction) _wrap_foo_xptoset_foo_type, METH_KEYWORDS|METH_VARARGS, NULL },
    {NULL, NULL, 0, NULL}
};
/* --- classes --- */


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

static int
_wrap_PyXptoSomeClass__tp_init(PyXptoSomeClass *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new xpto::SomeClass();
    return 0;
}

static PyMethodDef PyXptoSomeClass_methods[] = {
    {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 *) "foo.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 */
    "This is the docstring for SomeClass",                        /* 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 */
};


/* --- enumerations --- */




static PyObject *
initfoo_xpto(void)
{
    PyObject *m;
    m = Py_InitModule3((char *) "foo.xpto", foo_xpto_functions, NULL);
    if (m == NULL) {
        return NULL;
    }
    /* Register the 'xpto::SomeClass' class */
    if (PyType_Ready(&PyXptoSomeClass_Type)) {
        return NULL;
    }
    PyModule_AddObject(m, (char *) "SomeClass", (PyObject *) &PyXptoSomeClass_Type);
    PyModule_AddObject(m, (char *) "FooXpto", (PyObject *) &PyFoo_Type);
    PyModule_AddIntConstant(m, (char *) "FOO_TYPE_AAA", xpto::FOO_TYPE_AAA);
    PyModule_AddIntConstant(m, (char *) "FOO_TYPE_BBB", xpto::FOO_TYPE_BBB);
    PyModule_AddIntConstant(m, (char *) "FOO_TYPE_CCC", xpto::FOO_TYPE_CCC);
    return m;
}
static PyMethodDef foo_TopNs_PrefixBottomNs_functions[] = {
    {NULL, NULL, 0, NULL}
};
/* --- classes --- */



static int
_wrap_PyTopNsPrefixBottomNsPrefixInner__tp_init(PyTopNsPrefixBottomNsPrefixInner *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new TopNs::PrefixBottomNs::PrefixInner();
    return 0;
}


PyObject *
_wrap_PyTopNsPrefixBottomNsPrefixInner_Do(PyTopNsPrefixBottomNsPrefixInner *self)
{
    PyObject *py_retval;

    self->obj->Do();
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}

static PyMethodDef PyTopNsPrefixBottomNsPrefixInner_methods[] = {
    {(char *) "Do", (PyCFunction) _wrap_PyTopNsPrefixBottomNsPrefixInner_Do, 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 *) "foo.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 */
};



static PyObject *
initfoo_TopNs_PrefixBottomNs(void)
{
    PyObject *m;
    m = Py_InitModule3((char *) "foo.TopNs.PrefixBottomNs", foo_TopNs_PrefixBottomNs_functions, NULL);
    if (m == NULL) {
        return NULL;
    }
    /* Register the 'TopNs::PrefixBottomNs::PrefixInner' class */
    PyTopNsPrefixBottomNsPrefixInner_Type.tp_base = &PyTopNsOuterBase_Type;
    if (PyType_Ready(&PyTopNsPrefixBottomNsPrefixInner_Type)) {
        return NULL;
    }
    PyModule_AddObject(m, (char *) "PrefixInner", (PyObject *) &PyTopNsPrefixBottomNsPrefixInner_Type);
    return m;
}
static PyMethodDef foo_TopNs_functions[] = {
    {NULL, NULL, 0, NULL}
};
/* --- classes --- */


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

static int
_wrap_PyTopNsOuterBase__tp_init(void)
{
    PyErr_SetString(PyExc_TypeError, "class 'OuterBase' cannot be constructed ()");
    return -1;
}

static PyMethodDef PyTopNsOuterBase_methods[] = {
    {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 *) "foo.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 */
};



static PyObject *
initfoo_TopNs(void)
{
    PyObject *m;
    PyObject *submodule;
    m = Py_InitModule3((char *) "foo.TopNs", foo_TopNs_functions, NULL);
    if (m == NULL) {
        return NULL;
    }
    /* Register the 'TopNs::OuterBase' class */
    if (PyType_Ready(&PyTopNsOuterBase_Type)) {
        return NULL;
    }
    PyModule_AddObject(m, (char *) "OuterBase", (PyObject *) &PyTopNsOuterBase_Type);
    submodule = initfoo_TopNs_PrefixBottomNs();
    if (submodule == NULL) {
        return NULL;
    }
    Py_INCREF(submodule);
    PyModule_AddObject(m, (char *) "PrefixBottomNs", submodule);
    return m;
}
/* --- module functions --- */



PyObject *
_wrap_foofunction_that_takes_foo__0(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    PyObject *foo;
    Foo foo2;
    const char *keywords[] = {"foo", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O", (char **) keywords, &foo)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        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);
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    function_that_takes_foo(foo2);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


static PyObject *
_wrap_foofunction_that_takes_foo_from_string(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args,
                                             PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    char *datum;
    const char *keywords[] = {"foo", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s", (char **) keywords, &datum)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    function_that_takes_foo(Foo(datum));
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}


PyObject * _wrap_foofunction_that_takes_foo(PyObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject * retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_foofunction_that_takes_foo__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_foofunction_that_takes_foo_from_string(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_foofunction_that_takes_foo(PyObject *self, PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foomy_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_foomy_inverse_func2(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_footake_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_footake_some_object();


PyObject *
_wrap_fooget_simple_list()
{
    PyObject *py_retval;
    SimpleStructList retval;
    PySimpleStructList *py_SimpleStructList;

    retval = 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_fooget_simple_list();


PyObject *
_wrap_fooset_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_fooset_foobar_with_other_as_custodian(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_fooget_cannot_be_constructed_ptr()
{
    PyObject *py_retval;
    CannotBeConstructed *retval;
    PyCannotBeConstructed *py_CannotBeConstructed;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;

    retval = get_cannot_be_constructed_ptr();
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    wrapper_lookup_iter = PyCannotBeConstructed_wrapper_registry.find((void *) retval);
    if (wrapper_lookup_iter == PyCannotBeConstructed_wrapper_registry.end()) {
        py_CannotBeConstructed = NULL;
    } else {
        py_CannotBeConstructed = (PyCannotBeConstructed *) wrapper_lookup_iter->second;
        Py_INCREF(py_CannotBeConstructed);
    }

    if (py_CannotBeConstructed == NULL) {
        py_CannotBeConstructed = PyObject_New(PyCannotBeConstructed, &PyCannotBeConstructed_Type);
        py_CannotBeConstructed->obj = retval;
        py_CannotBeConstructed->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
        PyCannotBeConstructed_wrapper_registry[(void *) py_CannotBeConstructed->obj] = (PyObject *) py_CannotBeConstructed;
    }
    py_retval = Py_BuildValue((char *) "N", py_CannotBeConstructed);
    return py_retval;
}
PyObject * _wrap_fooget_cannot_be_constructed_ptr();


PyObject *
_wrap_foocreate_new_foobar()
{
    PyObject *py_retval;
    Foobar *retval;
    PyFoobar *py_Foobar;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;

    retval = create_new_foobar();
    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_NONE;
        PyFoobar_wrapper_registry[(void *) py_Foobar->obj] = (PyObject *) py_Foobar;
    }
    py_retval = Py_BuildValue((char *) "N", py_Foobar);
    return py_retval;
}
PyObject * _wrap_foocreate_new_foobar();


PyObject *
_wrap_fooget_hidden_subclass_pointer()
{
    PyObject *py_retval;
    Foo *retval;
    PyFoo *py_Foo;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    PyTypeObject *wrapper_type = 0;

    retval = get_hidden_subclass_pointer();
    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_fooget_hidden_subclass_pointer();


PyObject *
_wrap_fooprint_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;
    }
    if (PyErr_Warn(PyExc_DeprecationWarning, (char *) "Deprecated")) {
        return NULL;
    }
    retval = print_something(message);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}
PyObject * _wrap_fooprint_something(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foostore_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_foostore_some_object(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_fooprint_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_fooprint_something_else(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_fooget_foobar_with_other_as_custodian(PyObject * PYBINDGEN_UNUSED(dummy), 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 = 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_fooget_foobar_with_other_as_custodian(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foomake_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_foomake_interface_id();


PyObject *
_wrap_foofunction_that_returns_foo()
{
    PyObject *py_retval;
    PyFoo *py_Foo;

    Foo retval = function_that_returns_foo();
    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_foofunction_that_returns_foo();


PyObject *
_wrap_fooset_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_fooset_simple_list(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foodelete_some_object()
{
    PyObject *py_retval;

    delete_some_object();
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}
PyObject * _wrap_foodelete_some_object();


PyObject *
_wrap_fooset_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_fooset_foobar_with_return_as_custodian(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foodelete_stored_zbr()
{
    PyObject *py_retval;

    delete_stored_zbr();
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}
PyObject * _wrap_foodelete_stored_zbr();



PyObject *
_wrap_fooinvoke_some_object_get_prefix()
{
    PyObject *py_retval;
    std::string retval;

    retval = invoke_some_object_get_prefix();
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}
PyObject * _wrap_fooinvoke_some_object_get_prefix();


PyObject *
_wrap_fooTypeNameGet__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_fooTypeNameGet__lt__int__gt__();


PyObject *
_wrap_foomy_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_foomy_inverse_func(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);



PyObject *
_wrap_fooget_int_from_string__0(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    int retval;
    char const *from_string;
    int multiplier = 1;
    const char *keywords[] = {"from_string", "multiplier", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "s|i", (char **) keywords, &from_string, &multiplier)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    retval = get_int_from_string(from_string, multiplier);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

PyObject *
_wrap_fooget_int_from_string__1(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    int retval;
    double from_float;
    int multiplier = 1;
    const char *keywords[] = {"from_float", "multiplier", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "d|i", (char **) keywords, &from_float, &multiplier)) {
        {
            PyObject *exc_type, *traceback;
            PyErr_Fetch(&exc_type, return_exception, &traceback);
            Py_XDECREF(exc_type);
            Py_XDECREF(traceback);
        }
        return NULL;
    }
    retval = get_int_from_float(from_float, multiplier);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

PyObject * _wrap_fooget_int_from_string(PyObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject * retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_fooget_int_from_string__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_fooget_int_from_string__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_fooget_int_from_string(PyObject *self, PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foostore_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_foostore_zbr(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foomatrix_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_foomatrix_sum_of_elements(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);


PyObject *
_wrap_foomatrix_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;
}
PyObject * _wrap_foomatrix_identity_new();


PyObject *
_wrap_fooinvoke_zbr(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    int x;
    const char *keywords[] = {"x", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &x)) {
        return NULL;
    }
    retval = invoke_zbr(x);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}
PyObject * _wrap_fooinvoke_zbr(PyObject * PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs);

static PyMethodDef foo_functions[] = {
    {(char *) "function_that_takes_foo", (PyCFunction) _wrap_foofunction_that_takes_foo, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "my_inverse_func2", (PyCFunction) _wrap_foomy_inverse_func2, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "take_some_object", (PyCFunction) _wrap_footake_some_object, METH_NOARGS, NULL },
    {(char *) "get_simple_list", (PyCFunction) _wrap_fooget_simple_list, METH_NOARGS, NULL },
    {(char *) "set_foobar_with_other_as_custodian", (PyCFunction) _wrap_fooset_foobar_with_other_as_custodian, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_cannot_be_constructed_ptr", (PyCFunction) _wrap_fooget_cannot_be_constructed_ptr, METH_NOARGS, NULL },
    {(char *) "create_new_foobar", (PyCFunction) _wrap_foocreate_new_foobar, METH_NOARGS, NULL },
    {(char *) "get_hidden_subclass_pointer", (PyCFunction) _wrap_fooget_hidden_subclass_pointer, METH_NOARGS, NULL },
    {(char *) "print_something", (PyCFunction) _wrap_fooprint_something, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "store_some_object", (PyCFunction) _wrap_foostore_some_object, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "print_something_else", (PyCFunction) _wrap_fooprint_something_else, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_foobar_with_other_as_custodian", (PyCFunction) _wrap_fooget_foobar_with_other_as_custodian, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "make_interface_id", (PyCFunction) _wrap_foomake_interface_id, METH_NOARGS, NULL },
    {(char *) "function_that_returns_foo", (PyCFunction) _wrap_foofunction_that_returns_foo, METH_NOARGS, NULL },
    {(char *) "set_simple_list", (PyCFunction) _wrap_fooset_simple_list, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "delete_some_object", (PyCFunction) _wrap_foodelete_some_object, METH_NOARGS, NULL },
    {(char *) "set_foobar_with_return_as_custodian", (PyCFunction) _wrap_fooset_foobar_with_return_as_custodian, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "delete_stored_zbr", (PyCFunction) _wrap_foodelete_stored_zbr, METH_NOARGS, NULL },
    {(char *) "invoke_some_object_get_prefix", (PyCFunction) _wrap_fooinvoke_some_object_get_prefix, METH_NOARGS, NULL },
    {(char *) "IntegerTypeNameGet", (PyCFunction) _wrap_fooTypeNameGet__lt__int__gt__, METH_NOARGS, NULL },
    {(char *) "my_inverse_func", (PyCFunction) _wrap_foomy_inverse_func, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "get_int", (PyCFunction) _wrap_fooget_int_from_string, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "store_zbr", (PyCFunction) _wrap_foostore_zbr, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "matrix_sum_of_elements", (PyCFunction) _wrap_foomatrix_sum_of_elements, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "matrix_identity_new", (PyCFunction) _wrap_foomatrix_identity_new, METH_NOARGS, NULL },
    {(char *) "invoke_zbr", (PyCFunction) _wrap_fooinvoke_zbr, METH_KEYWORDS|METH_VARARGS, NULL },
    {NULL, NULL, 0, NULL}
};
/* --- classes --- */



pybindgen::TypeMap PyFoo__typeid_map;

std::map<void*, PyObject*> PyFoo_wrapper_registry;
static PyObject* _wrap_PyFoo__get_instance_count(PyObject * PYBINDGEN_UNUSED(obj), void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;

    py_retval = Py_BuildValue((char *) "i", Foo::instance_count);
    return py_retval;
}
static int _wrap_PyFoo__set_instance_count(PyFoo * 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", &Foo::instance_count)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef FooMeta__getsets[] = {
    {
        (char*) "instance_count", /* attribute name */
        (getter) _wrap_PyFoo__get_instance_count, /* C function to get the attribute */
        (setter) _wrap_PyFoo__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 PyFooMeta_Type = {
	PyObject_HEAD_INIT(NULL)
	0,					/* ob_size */
	(char *) "FooMeta",		        /* 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 */
	FooMeta__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_PyFoo__tp_init__0(PyFoo *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 Foo(std::string(datum, datum_len));
    self->obj->initialize();
    return 0;
}

static int
_wrap_PyFoo__tp_init__1(PyFoo *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 Foo();
    self->obj->initialize();
    return 0;
}

int _wrap_PyFoo__tp_init(PyFoo *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyFoo__tp_init__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyFoo__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_PyFoo_get_datum(PyFoo *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_PyFoo_add_sub(PyFoo *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    int a;
    int b = 3;
    bool subtract;
    PyObject *py_subtract = NULL;
    const char *keywords[] = {"a", "b", "subtract", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i|iO", (char **) keywords, &a, &b, &py_subtract)) {
        return NULL;
    }
    subtract = py_subtract? (bool) PyObject_IsTrue(py_subtract) : false;
    retval = Foo::add_sub(a, b, subtract);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_PyFoo_is_initialized(PyFoo *self)
{
    PyObject *py_retval;
    bool retval;

    retval = self->obj->is_initialized();
    py_retval = Py_BuildValue((char *) "N", PyBool_FromLong(retval));
    return py_retval;
}

static PyMethodDef PyFoo_methods[] = {
    {(char *) "get_datum", (PyCFunction) _wrap_PyFoo_get_datum, METH_NOARGS, NULL },
    {(char *) "add_sub", (PyCFunction) _wrap_PyFoo_add_sub, METH_KEYWORDS|METH_VARARGS|METH_STATIC, NULL },
    {(char *) "is_initialized", (PyCFunction) _wrap_PyFoo_is_initialized, METH_NOARGS, NULL },
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyFoo__tp_dealloc(PyFoo *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyFoo_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyFoo_wrapper_registry.end()) {
        PyFoo_wrapper_registry.erase(wrapper_lookup_iter);
    }

        Foo *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_PyFoo__tp_str(PyFoo *self)
{
    std::ostringstream oss;
    oss << *self->obj;
    return PyString_FromString(oss.str ().c_str ());
}


static PyObject*
_wrap_PyFoo__tp_richcompare (PyFoo *PYBINDGEN_UNUSED(self), PyFoo *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyFoo_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 PyFoo_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.Foo",            /* tp_name */
    sizeof(PyFoo),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyFoo__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)_wrap_PyFoo__tp_str,              /* 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_PyFoo__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyFoo_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_PyFoo__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)
{
    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;
}

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;
}

int _wrap_PyZoo__tp_init(PyZoo *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {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;
    }
    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_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 PyMethodDef PyZoo_methods[] = {
    {(char *) "get_datum", (PyCFunction) _wrap_PyZoo_get_datum, 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 *) "foo.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*> PyFoobar_wrapper_registry;
static PyObject* _wrap_PyFoobar__get_instance_count(PyObject * PYBINDGEN_UNUSED(obj), void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;

    py_retval = Py_BuildValue((char *) "i", Foobar::instance_count);
    return py_retval;
}
static int _wrap_PyFoobar__set_instance_count(PyFoobar * 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", &Foobar::instance_count)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef FoobarMeta__getsets[] = {
    {
        (char*) "instance_count", /* attribute name */
        (getter) _wrap_PyFoobar__get_instance_count, /* C function to get the attribute */
        (setter) _wrap_PyFoobar__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 PyFoobarMeta_Type = {
	PyObject_HEAD_INIT(NULL)
	0,					/* ob_size */
	(char *) "FoobarMeta",		        /* 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 */
	FoobarMeta__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_PyFoobar__tp_init(void)
{
    PyErr_SetString(PyExc_TypeError, "class 'Foobar' cannot be constructed ()");
    return -1;
}

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

static void
PyFoobar__tp_clear(PyFoobar *self)
{
    Py_CLEAR(self->inst_dict);
        Foobar *tmp = self->obj;
    self->obj = NULL;
    if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
        delete tmp;
    }
}


static int
PyFoobar__tp_traverse(PyFoobar *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);

    return 0;
}


static void
_wrap_PyFoobar__tp_dealloc(PyFoobar *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyFoobar_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyFoobar_wrapper_registry.end()) {
        PyFoobar_wrapper_registry.erase(wrapper_lookup_iter);
    }

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

static PyObject*
_wrap_PyFoobar__tp_richcompare (PyFoobar *PYBINDGEN_UNUSED(self), PyFoobar *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyFoobar_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 PyFoobar_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.Foobar",            /* tp_name */
    sizeof(PyFoobar),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyFoobar__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)PyFoobar__tp_traverse,     /* tp_traverse */
    (inquiry)PyFoobar__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PyFoobar__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyFoobar_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(PyFoobar, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PyFoobar__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_PyBar__tp_init(PyBar *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new Bar();
    self->obj->initialize();
    return 0;
}



PyObject *
_wrap_PyBar_Hooray__0(PyBar *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyObject *py_retval;
    std::string 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 = Bar::Hooray();
    py_retval = Py_BuildValue((char *) "s#", (retval).c_str(), (retval).size());
    return py_retval;
}


static PyObject *
_wrap_PyBar_Hooray_lenx(PyBar *PYBINDGEN_UNUSED(dummy), PyObject *args, PyObject *kwargs,
                        PyObject **return_exception)
{
    PyObject *py_retval;
    int x;
    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;
    }

    std::string retval;
    retval = Bar::Hooray();
    py_retval = Py_BuildValue((char *) "i", int(retval.size() + x));
    return py_retval;
}


PyObject * _wrap_PyBar_Hooray(PyBar *self, PyObject *args, PyObject *kwargs)
{
    PyObject * retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {0,};
    retval = _wrap_PyBar_Hooray__0(self, args, kwargs, &exceptions[0]);
    if (!exceptions[0]) {
        return retval;
    }
    retval = _wrap_PyBar_Hooray_lenx(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 PyMethodDef PyBar_methods[] = {
    {(char *) "Hooray", (PyCFunction) _wrap_PyBar_Hooray, METH_KEYWORDS|METH_VARARGS|METH_STATIC, NULL },
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyBar__tp_dealloc(PyBar *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyFoo_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyFoo_wrapper_registry.end()) {
        PyFoo_wrapper_registry.erase(wrapper_lookup_iter);
    }

        Bar *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_PyBar__tp_richcompare (PyBar *PYBINDGEN_UNUSED(self), PyBar *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyBar_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 PyBar_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.Bar",            /* tp_name */
    sizeof(PyBar),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyBar__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_PyBar__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyBar_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_PyBar__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;
}

int PyZbr__PythonHelper::custom_method_added_by_a_hook(int x)
{
  return x + 1;
}

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;
}

int _wrap_PyZbr__tp_init(PyZbr *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {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;
    }
    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_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  x;

    retval = self->obj->get_value(&x);
    py_retval = Py_BuildValue((char *) "ii", retval, x);
    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 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 },
    {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 *) "foo.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 */
};



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_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;
}

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);
    }
    py_Foo->obj = NULL;
    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_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_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;
}

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;
}
static PyObject* _wrap_PySomeObject__get_foo(PySomeObject *self, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    PyFoo *py_Foo;

    py_Foo = PyObject_New(PyFoo, &PyFoo_Type);
    py_Foo->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
    py_Foo->obj = new Foo(self->obj->get_foo_value());
    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;
}
static int _wrap_PySomeObject__set_foo(PySomeObject *self, PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    PyFoo *tmp_Foo;

    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "O!", &PyFoo_Type, &tmp_Foo)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Foo tmp_value = *tmp_Foo->obj;
    self->obj->set_foo_value(tmp_value);
    Py_DECREF(py_retval);
    return 0;
}
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*) "foo", /* attribute name */
        (getter) _wrap_PySomeObject__get_foo, /* C function to get the attribute */
        (setter) _wrap_PySomeObject__set_foo, /* C function to set the attribute */
        NULL, /* optional doc string */
        NULL /* optional additional data for getter and setter */
    },
    {
        (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_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 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 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)
{
    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__1(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[2] = {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;
    }
    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_PySomeObject_set_foo_by_ref(PySomeObject *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    PyFoo *foo;
    const char *keywords[] = {"foo", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyFoo_Type, &foo)) {
        return NULL;
    }
    self->obj->set_foo_by_ref(*((PyFoo *) foo)->obj);
    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_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_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_foosome_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_foosome_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_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_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_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___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_pholder(PySomeObject *self)
{
    PyObject *py_retval;
    PointerHolder< Zbr > retval;
    PyZbr *py_Zbr;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;

    retval = self->obj->get_zbr_pholder();
    if (!((retval).thePointer)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    if (typeid((*(retval).thePointer)) == typeid(PyZbr__PythonHelper))
    {
        py_Zbr = reinterpret_cast< PyZbr* >(reinterpret_cast< PyZbr__PythonHelper* >((retval).thePointer)->m_pyself);
        py_Zbr->obj = (retval).thePointer;
        (retval).thePointer->Unref();
        Py_INCREF(py_Zbr);
    } else {
        wrapper_lookup_iter = PyZbr_wrapper_registry.find((void *) (retval).thePointer);
        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).thePointer;
            py_Zbr->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
            PyZbr_wrapper_registry[(void *) py_Zbr->obj] = (PyObject *) py_Zbr;
        } else {
            (retval).thePointer->Unref();
        }
    }
    py_retval = Py_BuildValue((char *) "N", py_Zbr);
    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_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_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_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;
    PyZbr *zbr;
    Zbr *zbr_ptr;
    PointerHolder<Zbr > tmp;
    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_pholder((tmp.thePointer = (zbr_ptr), tmp));
    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_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_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_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_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_foosome_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 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 *) "get_internal_zbr", (PyCFunction) _wrap_PySomeObject_get_internal_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_foosome_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_foosome_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_foo_shared_ptr", (PyCFunction) _wrap_PySomeObject_get_foo_shared_ptr, METH_NOARGS, NULL },
    {(char *) "get_int", (PyCFunction) _wrap_PySomeObject_get_int, METH_KEYWORDS|METH_VARARGS, 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 *) "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_pyobject", (PyCFunction) _wrap_PySomeObject_get_pyobject, 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_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 *) "set_foo_value", (PyCFunction) _wrap_PySomeObject_set_foo_value, METH_KEYWORDS|METH_VARARGS, 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_foo_by_ref", (PyCFunction) _wrap_PySomeObject_get_foo_by_ref, METH_NOARGS, 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_foosome_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 },
    {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 *) "foo.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 */
};



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

static int
_wrap_PyClassThatTakesFoo__tp_init(PyClassThatTakesFoo *self, PyObject *args, PyObject *kwargs)
{
    PyObject *foo;
    Foo foo2;
    const char *keywords[] = {"foo", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O", (char **) keywords, &foo)) {
        return -1;
    }
    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 -1;
    }
    self->obj = new ClassThatTakesFoo(foo2);
    return 0;
}


PyObject *
_wrap_PyClassThatTakesFoo_get_foo(PyClassThatTakesFoo *self)
{
    PyObject *py_retval;
    PyFoo *py_Foo;

    Foo retval = self->obj->get_foo();
    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;
}

static PyMethodDef PyClassThatTakesFoo_methods[] = {
    {(char *) "get_foo", (PyCFunction) _wrap_PyClassThatTakesFoo_get_foo, METH_NOARGS, NULL },
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyClassThatTakesFoo__tp_dealloc(PyClassThatTakesFoo *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyClassThatTakesFoo_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyClassThatTakesFoo_wrapper_registry.end()) {
        PyClassThatTakesFoo_wrapper_registry.erase(wrapper_lookup_iter);
    }

        ClassThatTakesFoo *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_PyClassThatTakesFoo__tp_richcompare (PyClassThatTakesFoo *PYBINDGEN_UNUSED(self), PyClassThatTakesFoo *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyClassThatTakesFoo_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 PyClassThatTakesFoo_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.ClassThatTakesFoo",            /* tp_name */
    sizeof(PyClassThatTakesFoo),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyClassThatTakesFoo__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_PyClassThatTakesFoo__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyClassThatTakesFoo_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_PyClassThatTakesFoo__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(void)
{
    PyErr_SetString(PyExc_TypeError, "class 'SingletonClass' cannot be constructed ()");
    return -1;
}


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 PyMethodDef PySingletonClass_methods[] = {
    {(char *) "GetInstance", (PyCFunction) _wrap_PySingletonClass_GetInstance, METH_NOARGS|METH_STATIC, 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 *) "foo.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*> PyInterfaceId_wrapper_registry;

static int
_wrap_PyInterfaceId__tp_init(void)
{
    PyErr_SetString(PyExc_TypeError, "class 'InterfaceId' cannot be constructed ()");
    return -1;
}

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

static void
_wrap_PyInterfaceId__tp_dealloc(PyInterfaceId *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyInterfaceId_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyInterfaceId_wrapper_registry.end()) {
        PyInterfaceId_wrapper_registry.erase(wrapper_lookup_iter);
    }


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

static PyObject*
_wrap_PyInterfaceId__tp_richcompare (PyInterfaceId *PYBINDGEN_UNUSED(self), PyInterfaceId *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyInterfaceId_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 PyInterfaceId_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.InterfaceId",            /* tp_name */
    sizeof(PyInterfaceId),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyInterfaceId__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_PyInterfaceId__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyInterfaceId_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_PyInterfaceId__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*> PyCannotBeConstructed_wrapper_registry;

static int
_wrap_PyCannotBeConstructed__tp_init(void)
{
    PyErr_SetString(PyExc_TypeError, "class 'CannotBeConstructed' cannot be constructed (no reason)");
    return -1;
}


PyObject *
_wrap_PyCannotBeConstructed_get_ptr(void)
{
    PyObject *py_retval;
    CannotBeConstructed *retval;
    PyCannotBeConstructed *py_CannotBeConstructed;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;

    retval = CannotBeConstructed::get_ptr();
    if (!(retval)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    wrapper_lookup_iter = PyCannotBeConstructed_wrapper_registry.find((void *) retval);
    if (wrapper_lookup_iter == PyCannotBeConstructed_wrapper_registry.end()) {
        py_CannotBeConstructed = NULL;
    } else {
        py_CannotBeConstructed = (PyCannotBeConstructed *) wrapper_lookup_iter->second;
        Py_INCREF(py_CannotBeConstructed);
    }

    if (py_CannotBeConstructed == NULL) {
        py_CannotBeConstructed = PyObject_New(PyCannotBeConstructed, &PyCannotBeConstructed_Type);
        py_CannotBeConstructed->obj = retval;
        py_CannotBeConstructed->flags = PYBINDGEN_WRAPPER_FLAG_NONE;
        PyCannotBeConstructed_wrapper_registry[(void *) py_CannotBeConstructed->obj] = (PyObject *) py_CannotBeConstructed;
    }
    py_retval = Py_BuildValue((char *) "N", py_CannotBeConstructed);
    return py_retval;
}


static PyMethodDef PyCannotBeConstructed_methods[] = {
    {(char *) "get_ptr", (PyCFunction) _wrap_PyCannotBeConstructed_get_ptr, METH_NOARGS|METH_STATIC, NULL },
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyCannotBeConstructed__tp_dealloc(PyCannotBeConstructed *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyCannotBeConstructed_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyCannotBeConstructed_wrapper_registry.end()) {
        PyCannotBeConstructed_wrapper_registry.erase(wrapper_lookup_iter);
    }

        CannotBeConstructed *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_PyCannotBeConstructed__tp_richcompare (PyCannotBeConstructed *PYBINDGEN_UNUSED(self), PyCannotBeConstructed *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyCannotBeConstructed_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 PyCannotBeConstructed_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.CannotBeConstructed",            /* tp_name */
    sizeof(PyCannotBeConstructed),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyCannotBeConstructed__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_PyCannotBeConstructed__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyCannotBeConstructed_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_PyCannotBeConstructed__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 *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__1(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;
}

int _wrap_PySomeObjectNestedClass__tp_init(PySomeObjectNestedClass *self, PyObject *args, PyObject *kwargs)
{
    int retval;
    PyObject *error_list;
    PyObject *exceptions[2] = {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;
    }
    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_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 PyMethodDef PySomeObjectNestedClass_methods[] = {
    {(char *) "get_datum", (PyCFunction) _wrap_PySomeObjectNestedClass_get_datum, 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 *) "foo.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*> PyAbstractBaseClass2_wrapper_registry;

PyObject *
PyAbstractBaseClass2__PythonHelper::_wrap_protected_virtual(PyAbstractBaseClass2 *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    int x;
    PyAbstractBaseClass2__PythonHelper *helper = dynamic_cast< PyAbstractBaseClass2__PythonHelper* >(self->obj);
    const char *keywords[] = {"x", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &x)) {
        return NULL;
    }
    if (helper == NULL) {
        PyErr_SetString(PyExc_TypeError, "Method protected_virtual of class AbstractBaseClass2 is protected and can only be called by a subclass");
        return NULL;
    }
    retval = helper->protected_virtual__parent_caller(x);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

int
PyAbstractBaseClass2__PythonHelper::protected_virtual(int x) const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    AbstractBaseClass2 *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 *) "protected_virtual"); 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 AbstractBaseClass2::protected_virtual(x);
    }
    self_obj_before = reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj;
    reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = const_cast< AbstractBaseClass2* >((const AbstractBaseClass2*) this);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "protected_virtual", (char *) "i", x);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return AbstractBaseClass2::protected_virtual(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< PyAbstractBaseClass2* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return AbstractBaseClass2::protected_virtual(x);
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

int
PyAbstractBaseClass2__PythonHelper::protected_pure_virtual(int x) const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    AbstractBaseClass2 *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 *) "protected_pure_virtual"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);

        PyErr_Print();
        Py_FatalError("Error detected, but parent virtual is pure virtual or private virtual, "
                      "and return is a class without trival constructor");
    }
    self_obj_before = reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj;
    reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = const_cast< AbstractBaseClass2* >((const AbstractBaseClass2*) this);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "protected_pure_virtual", (char *) "i", x);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);

        PyErr_Print();
        Py_FatalError("Error detected, but parent virtual is pure virtual or private virtual, "
                      "and return is a class without trival constructor");
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);

        PyErr_Print();
        Py_FatalError("Error detected, but parent virtual is pure virtual or private virtual, "
                      "and return is a class without trival constructor");
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

int
PyAbstractBaseClass2__PythonHelper::private_virtual(int x) const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    AbstractBaseClass2 *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 *) "private_virtual"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);

        PyErr_Print();
        Py_FatalError("Error detected, but parent virtual is pure virtual or private virtual, "
                      "and return is a class without trival constructor");
    }
    self_obj_before = reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj;
    reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = const_cast< AbstractBaseClass2* >((const AbstractBaseClass2*) this);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "private_virtual", (char *) "i", x);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);

        PyErr_Print();
        Py_FatalError("Error detected, but parent virtual is pure virtual or private virtual, "
                      "and return is a class without trival constructor");
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);

        PyErr_Print();
        Py_FatalError("Error detected, but parent virtual is pure virtual or private virtual, "
                      "and return is a class without trival constructor");
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyAbstractBaseClass2* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

static int
_wrap_PyAbstractBaseClass2__tp_init(PyAbstractBaseClass2 *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    if (self->ob_type != &PyAbstractBaseClass2_Type)
    {
        self->obj = new PyAbstractBaseClass2__PythonHelper();
        ((PyAbstractBaseClass2__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'protected'
        PyErr_SetString(PyExc_TypeError, "class 'AbstractBaseClass2' cannot be constructed");
        return -1;
    }
    return 0;
}


PyObject *
_wrap_PyAbstractBaseClass2_invoke_protected_pure_virtual(PyAbstractBaseClass2 *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    int x;
    const char *keywords[] = {"x", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &x)) {
        return NULL;
    }
    retval = self->obj->invoke_protected_pure_virtual(x);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_PyAbstractBaseClass2_invoke_private_virtual(PyAbstractBaseClass2 *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    int x;
    const char *keywords[] = {"x", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &x)) {
        return NULL;
    }
    retval = self->obj->invoke_private_virtual(x);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_PyAbstractBaseClass2_invoke_protected_virtual(PyAbstractBaseClass2 *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int retval;
    int x;
    const char *keywords[] = {"x", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &x)) {
        return NULL;
    }
    retval = self->obj->invoke_protected_virtual(x);
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}

static PyMethodDef PyAbstractBaseClass2_methods[] = {
    {(char *) "invoke_protected_pure_virtual", (PyCFunction) _wrap_PyAbstractBaseClass2_invoke_protected_pure_virtual, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "invoke_private_virtual", (PyCFunction) _wrap_PyAbstractBaseClass2_invoke_private_virtual, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "invoke_protected_virtual", (PyCFunction) _wrap_PyAbstractBaseClass2_invoke_protected_virtual, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "protected_virtual", (PyCFunction) PyAbstractBaseClass2__PythonHelper::_wrap_protected_virtual, METH_KEYWORDS|METH_VARARGS, NULL },
    {NULL, NULL, 0, NULL}
};

static void
PyAbstractBaseClass2__tp_clear(PyAbstractBaseClass2 *self)
{
    Py_CLEAR(self->inst_dict);
        AbstractBaseClass2 *tmp = self->obj;
    self->obj = NULL;
    if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
        delete tmp;
    }
}


static int
PyAbstractBaseClass2__tp_traverse(PyAbstractBaseClass2 *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);

    if (self->obj && typeid(*self->obj) == typeid(PyAbstractBaseClass2__PythonHelper) )
        Py_VISIT((PyObject *) self);

    return 0;
}


static void
_wrap_PyAbstractBaseClass2__tp_dealloc(PyAbstractBaseClass2 *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyAbstractBaseClass2_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyAbstractBaseClass2_wrapper_registry.end()) {
        PyAbstractBaseClass2_wrapper_registry.erase(wrapper_lookup_iter);
    }

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

static PyObject*
_wrap_PyAbstractBaseClass2__tp_richcompare (PyAbstractBaseClass2 *PYBINDGEN_UNUSED(self), PyAbstractBaseClass2 *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyAbstractBaseClass2_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 PyAbstractBaseClass2_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.AbstractBaseClass2",            /* tp_name */
    sizeof(PyAbstractBaseClass2),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyAbstractBaseClass2__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)PyAbstractBaseClass2__tp_traverse,     /* tp_traverse */
    (inquiry)PyAbstractBaseClass2__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PyAbstractBaseClass2__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyAbstractBaseClass2_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(PyAbstractBaseClass2, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PyAbstractBaseClass2__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*> PyAbstractXpto_wrapper_registry;

void
PyAbstractXpto__PythonHelper::something(int x) const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    AbstractXpto *self_obj_before;
    PyObject *py_retval;

    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "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;
    }
    self_obj_before = reinterpret_cast< PyAbstractXpto* >(m_pyself)->obj;
    reinterpret_cast< PyAbstractXpto* >(m_pyself)->obj = const_cast< AbstractXpto* >((const AbstractXpto*) this);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "something", (char *) "i", x);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyAbstractXpto* >(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< PyAbstractXpto* >(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< PyAbstractXpto* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return;
}

static int
_wrap_PyAbstractXpto__tp_init(PyAbstractXpto *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    if (self->ob_type != &PyAbstractXpto_Type)
    {
        self->obj = new PyAbstractXpto__PythonHelper();
        ((PyAbstractXpto__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        PyErr_SetString(PyExc_TypeError, "class 'AbstractXpto' cannot be constructed");
        return -1;
    }
    return 0;
}


PyObject *
_wrap_PyAbstractXpto_something(PyAbstractXpto *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int x;
    const char *keywords[] = {"x", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &x)) {
        return NULL;
    }
    self->obj->something(x);
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}

static PyMethodDef PyAbstractXpto_methods[] = {
    {(char *) "something", (PyCFunction) _wrap_PyAbstractXpto_something, METH_KEYWORDS|METH_VARARGS, NULL },
    {NULL, NULL, 0, NULL}
};

static void
PyAbstractXpto__tp_clear(PyAbstractXpto *self)
{
    Py_CLEAR(self->inst_dict);
        AbstractXpto *tmp = self->obj;
    self->obj = NULL;
    if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
        delete tmp;
    }
}


static int
PyAbstractXpto__tp_traverse(PyAbstractXpto *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);

    if (self->obj && typeid(*self->obj) == typeid(PyAbstractXpto__PythonHelper) )
        Py_VISIT((PyObject *) self);

    return 0;
}


static void
_wrap_PyAbstractXpto__tp_dealloc(PyAbstractXpto *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyAbstractXpto_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyAbstractXpto_wrapper_registry.end()) {
        PyAbstractXpto_wrapper_registry.erase(wrapper_lookup_iter);
    }

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

static PyObject*
_wrap_PyAbstractXpto__tp_richcompare (PyAbstractXpto *PYBINDGEN_UNUSED(self), PyAbstractXpto *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyAbstractXpto_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 PyAbstractXpto_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.AbstractXpto",            /* tp_name */
    sizeof(PyAbstractXpto),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyAbstractXpto__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)PyAbstractXpto__tp_traverse,     /* tp_traverse */
    (inquiry)PyAbstractXpto__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PyAbstractXpto__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyAbstractXpto_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(PyAbstractXpto, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PyAbstractXpto__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 */
};




void
PyAbstractXptoImpl__PythonHelper::something(int x) const
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    AbstractXptoImpl *self_obj_before;
    PyObject *py_retval;

    __py_gil_state = (PyEval_ThreadsInitialized() ? PyGILState_Ensure() : (PyGILState_STATE) 0);
    py_method = PyObject_GetAttrString(m_pyself, (char *) "something"); PyErr_Clear();
    if (py_method == NULL || py_method->ob_type == &PyCFunction_Type) {
        AbstractXptoImpl::something(x);
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
        return;
    }
    self_obj_before = reinterpret_cast< PyAbstractXptoImpl* >(m_pyself)->obj;
    reinterpret_cast< PyAbstractXptoImpl* >(m_pyself)->obj = const_cast< AbstractXptoImpl* >((const AbstractXptoImpl*) this);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "something", (char *) "i", x);
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyAbstractXptoImpl* >(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< PyAbstractXptoImpl* >(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< PyAbstractXptoImpl* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return;
}

static int
_wrap_PyAbstractXptoImpl__tp_init(PyAbstractXptoImpl *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    if (self->ob_type != &PyAbstractXptoImpl_Type)
    {
        self->obj = new PyAbstractXptoImpl__PythonHelper();
        ((PyAbstractXptoImpl__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
    } else {
        // visibility: 'public'
        self->obj = new AbstractXptoImpl();
    }
    return 0;
}


PyObject *
_wrap_PyAbstractXptoImpl_something(PyAbstractXptoImpl *self, PyObject *args, PyObject *kwargs)
{
    PyObject *py_retval;
    int x;
    PyAbstractXptoImpl__PythonHelper *helper_class = dynamic_cast<PyAbstractXptoImpl__PythonHelper*> (self->obj);
    const char *keywords[] = {"x", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "i", (char **) keywords, &x)) {
        return NULL;
    }
    (helper_class == NULL)? (self->obj->something(x)) : (self->obj->AbstractXptoImpl::something(x));
    Py_INCREF(Py_None);
    py_retval = Py_None;
    return py_retval;
}

static PyMethodDef PyAbstractXptoImpl_methods[] = {
    {(char *) "something", (PyCFunction) _wrap_PyAbstractXptoImpl_something, METH_KEYWORDS|METH_VARARGS, NULL },
    {NULL, NULL, 0, NULL}
};

static void
PyAbstractXptoImpl__tp_clear(PyAbstractXptoImpl *self)
{
    Py_CLEAR(self->inst_dict);
        AbstractXptoImpl *tmp = self->obj;
    self->obj = NULL;
    if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
        delete tmp;
    }
}


static int
PyAbstractXptoImpl__tp_traverse(PyAbstractXptoImpl *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);

    if (self->obj && typeid(*self->obj) == typeid(PyAbstractXptoImpl__PythonHelper) )
        Py_VISIT((PyObject *) self);

    return 0;
}


static void
_wrap_PyAbstractXptoImpl__tp_dealloc(PyAbstractXptoImpl *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyAbstractXpto_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyAbstractXpto_wrapper_registry.end()) {
        PyAbstractXpto_wrapper_registry.erase(wrapper_lookup_iter);
    }

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

static PyObject*
_wrap_PyAbstractXptoImpl__tp_richcompare (PyAbstractXptoImpl *PYBINDGEN_UNUSED(self), PyAbstractXptoImpl *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyAbstractXptoImpl_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 PyAbstractXptoImpl_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.AbstractXptoImpl",            /* tp_name */
    sizeof(PyAbstractXptoImpl),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyAbstractXptoImpl__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)PyAbstractXptoImpl__tp_traverse,     /* tp_traverse */
    (inquiry)PyAbstractXptoImpl__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PyAbstractXptoImpl__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyAbstractXptoImpl_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(PyAbstractXptoImpl, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PyAbstractXptoImpl__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(PyWord *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new Word();
    return 0;
}

static PyMethodDef PyWord_methods[] = {
    {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 *) "foo.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*> 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(PySocket *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        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;
}



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 PyMethodDef PySocket_methods[] = {
    {(char *) "Bind", (PyCFunction) _wrap_PySocket_Bind, METH_KEYWORDS|METH_VARARGS, 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 *) "foo.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 */
};




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(PyUdpSocket *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        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;
}


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 PyMethodDef PyUdpSocket_methods[] = {
    {(char *) "Bind", (PyCFunction) _wrap_PyUdpSocket_Bind, 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 *) "foo.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*> 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 *ctor_arg;
    const char *keywords[] = {"ctor_arg", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PySimple_struct_t_Type, &ctor_arg)) {
        {
            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 *) ctor_arg)->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 *) "foo.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 */
};



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;
}

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;
}

std::vector< simple_struct_t >
PyTestContainer__PythonHelper::get_simple_vec()
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    std::vector< simple_struct_t > 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__std__vector__lt___simple_struct_t___gt__, &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_vec(std::vector< simple_struct_t > vec)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    int retval;
    Pystd__vector__lt__simple_struct_t__gt__ *py_std__vector__lt__simple_struct_t__gt__;

    __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_std__vector__lt__simple_struct_t__gt__ = PyObject_New(Pystd__vector__lt__simple_struct_t__gt__, &Pystd__vector__lt__simple_struct_t__gt___Type);
    py_std__vector__lt__simple_struct_t__gt__->obj = new std::vector<simple_struct_t>(vec);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "set_simple_vec", (char *) "N", py_std__vector__lt__simple_struct_t__gt__);
    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;
}

std::map< std::string, simple_struct_t >
PyTestContainer__PythonHelper::get_simple_map()
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    std::map< std::string, simple_struct_t > 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__std__map__lt___std__string__simple_struct_t___gt__, &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;
}

int
PyTestContainer__PythonHelper::set_simple_map(std::map< std::string, simple_struct_t > map)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    TestContainer *self_obj_before;
    PyObject *py_retval;
    int retval;
    Pystd__map__lt__std__string__simple_struct_t__gt__ *py_std__map__lt__std__string__simple_struct_t__gt__;

    __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_std__map__lt__std__string__simple_struct_t__gt__ = PyObject_New(Pystd__map__lt__std__string__simple_struct_t__gt__, &Pystd__map__lt__std__string__simple_struct_t__gt___Type);
    py_std__map__lt__std__string__simple_struct_t__gt__->obj = new std::map<std::string, simple_struct_t>(map);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "set_simple_map", (char *) "N", py_std__map__lt__std__string__simple_struct_t__gt__);
    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;
}
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(PyTestContainer *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        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;
}


PyObject *
_wrap_PyTestContainer_get_simple_map(PyTestContainer *self)
{
    PyObject *py_retval;
    std::map< std::string, simple_struct_t > retval;
    PyTestContainer__PythonHelper *helper_class = dynamic_cast<PyTestContainer__PythonHelper*> (self->obj);
    Pystd__map__lt__std__string__simple_struct_t__gt__ *py_std__map__lt__std__string__simple_struct_t__gt__;

    retval = (helper_class == NULL)? (self->obj->get_simple_map()) : (self->obj->TestContainer::get_simple_map());
    py_std__map__lt__std__string__simple_struct_t__gt__ = PyObject_New(Pystd__map__lt__std__string__simple_struct_t__gt__, &Pystd__map__lt__std__string__simple_struct_t__gt___Type);
    py_std__map__lt__std__string__simple_struct_t__gt__->obj = new std::map<std::string, simple_struct_t>(retval);
    py_retval = Py_BuildValue((char *) "N", py_std__map__lt__std__string__simple_struct_t__gt__);
    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_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;
    std::vector<simple_struct_t> 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__std__vector__lt___simple_struct_t___gt__, &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;
    std::map<std::string, simple_struct_t> 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__std__map__lt___std__string__simple_struct_t___gt__, &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_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_simple_vec(PyTestContainer *self)
{
    PyObject *py_retval;
    std::vector< simple_struct_t > retval;
    PyTestContainer__PythonHelper *helper_class = dynamic_cast<PyTestContainer__PythonHelper*> (self->obj);
    Pystd__vector__lt__simple_struct_t__gt__ *py_std__vector__lt__simple_struct_t__gt__;

    retval = (helper_class == NULL)? (self->obj->get_simple_vec()) : (self->obj->TestContainer::get_simple_vec());
    py_std__vector__lt__simple_struct_t__gt__ = PyObject_New(Pystd__vector__lt__simple_struct_t__gt__, &Pystd__vector__lt__simple_struct_t__gt___Type);
    py_std__vector__lt__simple_struct_t__gt__->obj = new std::vector<simple_struct_t>(retval);
    py_retval = Py_BuildValue((char *) "N", py_std__vector__lt__simple_struct_t__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 PyMethodDef PyTestContainer_methods[] = {
    {(char *) "get_simple_map", (PyCFunction) _wrap_PyTestContainer_get_simple_map, METH_NOARGS, NULL },
    {(char *) "set_simple_list_by_ref", (PyCFunction) _wrap_PyTestContainer_set_simple_list_by_ref, METH_KEYWORDS|METH_VARARGS, 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 *) "get_vec_ptr", (PyCFunction) _wrap_PyTestContainer_get_vec_ptr, METH_NOARGS, NULL },
    {(char *) "get_simple_vec", (PyCFunction) _wrap_PyTestContainer_get_simple_vec, METH_NOARGS, NULL },
    {(char *) "get_vec", (PyCFunction) _wrap_PyTestContainer_get_vec, 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 *) "foo.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)
{
    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;
}

static int
_wrap_PyTupl__tp_init__1(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;
}

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__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(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(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(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(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;
        Tupl right;
        if (_wrap_convert_py2c__Tupl(py_left, &left) && _wrap_convert_py2c__Tupl(py_right, &right)) {
            Tupl result = (left += right);
            return _wrap_convert_c2py__Tupl(&result);
        }
        PyErr_Clear();
    }
    {
        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();
    }
    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(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(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(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 *) "foo.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 */
};



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 *) "foo.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*> 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 *) "foo.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*> PyVectorLike_wrapper_registry;

static int
_wrap_PyVectorLike__tp_init(PyVectorLike *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new VectorLike();
    return 0;
}


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 PyMethodDef PyVectorLike_methods[] = {
    {(char *) "append", (PyCFunction) _wrap_PyVectorLike_append, METH_KEYWORDS|METH_VARARGS, 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 *) "foo.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(PyVectorLike2 *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new VectorLike2();
    return 0;
}


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 PyMethodDef PyVectorLike2_methods[] = {
    {(char *) "append", (PyCFunction) _wrap_PyVectorLike2_append, METH_KEYWORDS|METH_VARARGS, 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 *) "foo.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 *) "foo.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*> PyMapLike_wrapper_registry;

static int
_wrap_PyMapLike__tp_init(PyMapLike *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new MapLike();
    return 0;
}


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 PyMethodDef PyMapLike_methods[] = {
    {(char *) "set", (PyCFunction) _wrap_PyMapLike_set, METH_KEYWORDS|METH_VARARGS, 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 *) "foo.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 *) "foo.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*> PyClassThatThrows_wrapper_registry;

int
PyClassThatThrows__PythonHelper::throw_error() const throw (std::exception)
{
    PyGILState_STATE __py_gil_state;
    PyObject *py_method;
    ClassThatThrows *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 *) "throw_error"); 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 ClassThatThrows::throw_error();
    }
    self_obj_before = reinterpret_cast< PyClassThatThrows* >(m_pyself)->obj;
    reinterpret_cast< PyClassThatThrows* >(m_pyself)->obj = const_cast< ClassThatThrows* >((const ClassThatThrows*) this);
    py_retval = PyObject_CallMethod(m_pyself, (char *) "throw_error", (char *) "");
    if (py_retval == NULL) {
        PyErr_Print();
        reinterpret_cast< PyClassThatThrows* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return ClassThatThrows::throw_error();
    }
    py_retval = Py_BuildValue((char*) "(N)", py_retval);
    if (!PyArg_ParseTuple(py_retval, (char *) "i", &retval)) {
        PyErr_Print();
        Py_DECREF(py_retval);
        reinterpret_cast< PyClassThatThrows* >(m_pyself)->obj = self_obj_before;
        Py_XDECREF(py_method);
        if (PyEval_ThreadsInitialized())
            PyGILState_Release(__py_gil_state);
        return ClassThatThrows::throw_error();
    }
    Py_DECREF(py_retval);
    reinterpret_cast< PyClassThatThrows* >(m_pyself)->obj = self_obj_before;
    Py_XDECREF(py_method);
    if (PyEval_ThreadsInitialized())
        PyGILState_Release(__py_gil_state);
    return retval;
}

static int
_wrap_PyClassThatThrows__tp_init(PyClassThatThrows *self, PyObject *args, PyObject *kwargs)
{
    double x;
    const char *keywords[] = {"x", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "d", (char **) keywords, &x)) {
        return -1;
    }
    try
    {
        if (self->ob_type != &PyClassThatThrows_Type)
        {
            self->obj = new PyClassThatThrows__PythonHelper(x);
            ((PyClassThatThrows__PythonHelper*) self->obj)->set_pyobj((PyObject *)self);
        } else {
            // visibility: 'public'
            self->obj = new ClassThatThrows(x);
        }
    } catch (DomainError const &exc) {
        PyErr_SetNone((PyObject *) PyDomainError_Type);
        return -1;
    }
    return 0;
}


PyObject *
_wrap_PyClassThatThrows_throw_error(PyClassThatThrows *self)
{
    PyObject *py_retval;
    int retval;
    PyClassThatThrows__PythonHelper *helper_class = dynamic_cast<PyClassThatThrows__PythonHelper*> (self->obj);

    try
    {
        retval = (helper_class == NULL)? (self->obj->throw_error()) : (self->obj->ClassThatThrows::throw_error());
    } catch (std::exception const &exc) {
        PyErr_SetString((PyObject *) Pystd__exception_Type, exc.what());
        return NULL;
    }
    py_retval = Py_BuildValue((char *) "i", retval);
    return py_retval;
}


PyObject *
_wrap_PyClassThatThrows_my_inverse_method(PyClassThatThrows *self, 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 = self->obj->my_inverse_method(x);
    } catch (DomainError const &exc) {
        PyErr_SetNone((PyObject *) PyDomainError_Type);
        return NULL;
    }
    py_retval = Py_BuildValue((char *) "d", retval);
    return py_retval;
}


PyObject *
_wrap_PyClassThatThrows_my_inverse_method2(PyClassThatThrows *self, 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 = self->obj->my_inverse_method2(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;
}

static PyMethodDef PyClassThatThrows_methods[] = {
    {(char *) "throw_error", (PyCFunction) _wrap_PyClassThatThrows_throw_error, METH_NOARGS, NULL },
    {(char *) "my_inverse_method", (PyCFunction) _wrap_PyClassThatThrows_my_inverse_method, METH_KEYWORDS|METH_VARARGS, NULL },
    {(char *) "my_inverse_method2", (PyCFunction) _wrap_PyClassThatThrows_my_inverse_method2, METH_KEYWORDS|METH_VARARGS, NULL },
    {NULL, NULL, 0, NULL}
};

static void
PyClassThatThrows__tp_clear(PyClassThatThrows *self)
{
    Py_CLEAR(self->inst_dict);
        ClassThatThrows *tmp = self->obj;
    self->obj = NULL;
    if (!(self->flags&PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED)) {
        delete tmp;
    }
}


static int
PyClassThatThrows__tp_traverse(PyClassThatThrows *self, visitproc visit, void *arg)
{
    Py_VISIT(self->inst_dict);

    if (self->obj && typeid(*self->obj) == typeid(PyClassThatThrows__PythonHelper) )
        Py_VISIT((PyObject *) self);

    return 0;
}


static void
_wrap_PyClassThatThrows__tp_dealloc(PyClassThatThrows *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyClassThatThrows_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyClassThatThrows_wrapper_registry.end()) {
        PyClassThatThrows_wrapper_registry.erase(wrapper_lookup_iter);
    }

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

static PyObject*
_wrap_PyClassThatThrows__tp_richcompare (PyClassThatThrows *PYBINDGEN_UNUSED(self), PyClassThatThrows *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyClassThatThrows_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 PyClassThatThrows_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.ClassThatThrows",            /* tp_name */
    sizeof(PyClassThatThrows),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyClassThatThrows__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)PyClassThatThrows__tp_traverse,     /* tp_traverse */
    (inquiry)PyClassThatThrows__tp_clear,             /* tp_clear */
    (richcmpfunc)_wrap_PyClassThatThrows__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyClassThatThrows_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(PyClassThatThrows, inst_dict),                 /* tp_dictoffset */
    (initproc)_wrap_PyClassThatThrows__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 *) "foo.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*> PyProperty__StdString_wrapper_registry;


static int
_wrap_PyProperty__StdString__tp_init__0(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;
}

static int
_wrap_PyProperty__StdString__tp_init__1(PyProperty__StdString *self, PyObject *args, PyObject *kwargs, PyObject **return_exception)
{
    PyProperty__StdString *ctor_arg;
    const char *keywords[] = {"ctor_arg", NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "O!", (char **) keywords, &PyProperty__StdString_Type, &ctor_arg)) {
        {
            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 *) ctor_arg)->obj);
    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 *) "foo.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*> PyBox_wrapper_registry;
static PyObject* _wrap_PyBox__get_m_internalFoobar(PyBox *self, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    PyFoobar *py_Foobar;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;

    if (!(self->obj->m_internalFoobar)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    wrapper_lookup_iter = PyFoobar_wrapper_registry.find((void *) self->obj->m_internalFoobar);
    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 = self->obj->m_internalFoobar;
        py_Foobar->flags = PYBINDGEN_WRAPPER_FLAG_OBJECT_NOT_OWNED;
        PyFoobar_wrapper_registry[(void *) py_Foobar->obj] = (PyObject *) py_Foobar;
    }
    py_retval = Py_BuildValue((char *) "N", py_Foobar);
    return py_retval;
}
static int _wrap_PyBox__set_m_internalFoobar(PyBox *self, PyObject *value, void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;
    PyFoobar *tmp_Foobar;

    py_retval = Py_BuildValue((char *) "(O)", value);
    if (!PyArg_ParseTuple(py_retval, (char *) "O!", &PyFoobar_Type, &tmp_Foobar)) {
        Py_DECREF(py_retval);
        return -1;
    }
    // dangerous!
    self->obj->m_internalFoobar = tmp_Foobar->obj;
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef PyBox__getsets[] = {
    {
        (char*) "m_internalFoobar", /* attribute name */
        (getter) _wrap_PyBox__get_m_internalFoobar, /* C function to get the attribute */
        (setter) _wrap_PyBox__set_m_internalFoobar, /* 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_PyBox__get_instance_count(PyObject * PYBINDGEN_UNUSED(obj), void * PYBINDGEN_UNUSED(closure))
{
    PyObject *py_retval;

    py_retval = Py_BuildValue((char *) "i", Box::instance_count);
    return py_retval;
}
static int _wrap_PyBox__set_instance_count(PyBox * 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", &Box::instance_count)) {
        Py_DECREF(py_retval);
        return -1;
    }
    Py_DECREF(py_retval);
    return 0;
}
static PyGetSetDef BoxMeta__getsets[] = {
    {
        (char*) "instance_count", /* attribute name */
        (getter) _wrap_PyBox__get_instance_count, /* C function to get the attribute */
        (setter) _wrap_PyBox__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 PyBoxMeta_Type = {
	PyObject_HEAD_INIT(NULL)
	0,					/* ob_size */
	(char *) "BoxMeta",		        /* 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 */
	BoxMeta__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_PyBox__tp_init(PyBox *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new Box();
    return 0;
}


PyObject *
_wrap_PyBox_getFoobarInternalPtr2(PyBox *self)
{
    PyObject *py_retval;
    Foobar *retval;
    PyFoobar *py_Foobar;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    PyObject *wards;

    retval = self->obj->getFoobarInternalPtr2();
    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 *) py_Foobar), (char *) "__wards__");
    if (wards == NULL) {
        PyErr_Clear();
        wards = PyList_New(0);
        PyObject_SetAttrString(((PyObject *) py_Foobar), (char *) "__wards__", wards);
    }
    if (((PyObject *) self) && !PySequence_Contains(wards, ((PyObject *) self)))
        PyList_Append(wards, ((PyObject *) self));
    py_retval = Py_BuildValue((char *) "N", py_Foobar);
    Py_DECREF(wards);
    return py_retval;
}


PyObject *
_wrap_PyBox_getFoobarInternalRef2(PyBox *self)
{
    PyObject *py_retval;
    PyFoobar *py_Foobar;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;
    PyObject *wards;

    Foobar & retval = self->obj->getFoobarInternalRef2();
    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 *) py_Foobar), (char *) "__wards__");
    if (wards == NULL) {
        PyErr_Clear();
        wards = PyList_New(0);
        PyObject_SetAttrString(((PyObject *) py_Foobar), (char *) "__wards__", wards);
    }
    if (((PyObject *) self) && !PySequence_Contains(wards, ((PyObject *) self)))
        PyList_Append(wards, ((PyObject *) self));
    py_retval = Py_BuildValue((char *) "N", py_Foobar);
    Py_DECREF(wards);
    return py_retval;
}


PyObject *
_wrap_PyBox_getFoobarInternalPtr(PyBox *self)
{
    PyObject *py_retval;
    Foobar *retval;
    PyFoobar *py_Foobar;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;

    retval = self->obj->getFoobarInternalPtr();
    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;
    }
    py_retval = Py_BuildValue((char *) "N", py_Foobar);
    return py_retval;
}


PyObject *
_wrap_PyBox_getFoobarInternalRef(PyBox *self)
{
    PyObject *py_retval;
    PyFoobar *py_Foobar;
    std::map<void*, PyObject*>::const_iterator wrapper_lookup_iter;

    Foobar & retval = self->obj->getFoobarInternalRef();
    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;
    }
    py_retval = Py_BuildValue((char *) "N", py_Foobar);
    return py_retval;
}

static PyMethodDef PyBox_methods[] = {
    {(char *) "getFoobarInternalPtr2", (PyCFunction) _wrap_PyBox_getFoobarInternalPtr2, METH_NOARGS, NULL },
    {(char *) "getFoobarInternalRef2", (PyCFunction) _wrap_PyBox_getFoobarInternalRef2, METH_NOARGS, NULL },
    {(char *) "getFoobarInternalPtr", (PyCFunction) _wrap_PyBox_getFoobarInternalPtr, METH_NOARGS, NULL },
    {(char *) "getFoobarInternalRef", (PyCFunction) _wrap_PyBox_getFoobarInternalRef, METH_NOARGS, NULL },
    {NULL, NULL, 0, NULL}
};

static void
_wrap_PyBox__tp_dealloc(PyBox *self)
{
    std::map<void*, PyObject*>::iterator wrapper_lookup_iter;
    wrapper_lookup_iter = PyBox_wrapper_registry.find((void *) self->obj);
    if (wrapper_lookup_iter != PyBox_wrapper_registry.end()) {
        PyBox_wrapper_registry.erase(wrapper_lookup_iter);
    }

        Box *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_PyBox__tp_richcompare (PyBox *PYBINDGEN_UNUSED(self), PyBox *other, int opid)
{

    if (!PyObject_IsInstance((PyObject*) other, (PyObject*) &PyBox_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 PyBox_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.Box",            /* tp_name */
    sizeof(PyBox),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_PyBox__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_PyBox__tp_richcompare,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)NULL,          /* tp_iter */
    (iternextfunc)NULL,     /* tp_iternext */
    (struct PyMethodDef*)PyBox_methods, /* tp_methods */
    (struct PyMemberDef*)0,              /* tp_members */
    PyBox__getsets,                     /* tp_getset */
    NULL,                              /* tp_base */
    NULL,                              /* tp_dict */
    (descrgetfunc)NULL,    /* tp_descr_get */
    (descrsetfunc)NULL,    /* tp_descr_set */
    0,                 /* tp_dictoffset */
    (initproc)_wrap_PyBox__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*> PyMIRoot_wrapper_registry;

static int
_wrap_PyMIRoot__tp_init(PyMIRoot *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new MIRoot();
    return 0;
}


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 PyMethodDef PyMIRoot_methods[] = {
    {(char *) "root_method", (PyCFunction) _wrap_PyMIRoot_root_method, 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 *) "foo.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 */
};




static int
_wrap_PyMIBase1__tp_init(PyMIBase1 *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new MIBase1();
    return 0;
}


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 PyMethodDef PyMIBase1_methods[] = {
    {(char *) "base1_method", (PyCFunction) _wrap_PyMIBase1_base1_method, 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 *) "foo.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(PyMIBase2 *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new MIBase2();
    return 0;
}


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 PyMethodDef PyMIBase2_methods[] = {
    {(char *) "base2_method", (PyCFunction) _wrap_PyMIBase2_base2_method, 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 *) "foo.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(PyMIMixed *self, PyObject *args, PyObject *kwargs)
{
    const char *keywords[] = {NULL};

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char *) "", (char **) keywords)) {
        return -1;
    }
    self->obj = new MIMixed();
    return 0;
}


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 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 },
    {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 *) "foo.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 */
};


/* --- containers --- */



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 *) "foo.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 *) "foo.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__set__lt__float__gt__Iter__tp_clear(Pystd__set__lt__float__gt__Iter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

}


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


static void
_wrap_Pystd__set__lt__float__gt____tp_dealloc(Pystd__set__lt__float__gt__ *self)
{
    delete self->obj;
    self->obj = NULL;

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


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

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


static PyObject*
_wrap_Pystd__set__lt__float__gt____tp_iter(Pystd__set__lt__float__gt__ *self)
{
    Pystd__set__lt__float__gt__Iter *iter = PyObject_GC_New(Pystd__set__lt__float__gt__Iter, &Pystd__set__lt__float__gt__Iter_Type);
    Py_INCREF(self);
    iter->container = self;
    iter->iterator = new std::set<float>::iterator(self->obj->begin());
    return (PyObject*) iter;
}


static PyObject*
_wrap_Pystd__set__lt__float__gt__Iter__tp_iter(Pystd__set__lt__float__gt__Iter *self)
{
    Py_INCREF(self);
    return (PyObject*) self;
}

static PyObject* _wrap_Pystd__set__lt__float__gt__Iter__tp_iternext(Pystd__set__lt__float__gt__Iter *self)
{
    PyObject *py_retval;
    std::set<float>::iterator iter;

    iter = *self->iterator;
    if (iter == self->container->obj->end()) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    ++(*self->iterator);
    py_retval = Py_BuildValue((char *) "f", (*iter));
    return py_retval;
}

int _wrap_convert_py2c__float(PyObject *value, float *address)
{
    PyObject *py_retval;

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


int _wrap_convert_py2c__std__set__lt___float___gt__(PyObject *arg, std::set<float> *container)
{
    if (PyObject_IsInstance(arg, (PyObject*) &Pystd__set__lt__float__gt___Type)) {
        *container = *((Pystd__set__lt__float__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++) {
            float item;
            if (!_wrap_convert_py2c__float(PyList_GET_ITEM(arg, i), &item)) {
                return 0;
            }
            container->insert(item);
        }
    } else {
        PyErr_SetString(PyExc_TypeError, "parameter must be None, a Std__set__lt__float__gt__ instance, or a list of float");
        return 0;
    }
    return 1;
}


static int
_wrap_Pystd__set__lt__float__gt____tp_init(Pystd__set__lt__float__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::set<float>;

    if (arg == NULL)
        return 0;

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

PyTypeObject Pystd__set__lt__float__gt___Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.Std__set__lt__float__gt__",            /* tp_name */
    sizeof(Pystd__set__lt__float__gt__),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_Pystd__set__lt__float__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__set__lt__float__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__set__lt__float__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__set__lt__float__gt__Iter_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.Std__set__lt__float__gt__Iter",            /* tp_name */
    sizeof(Pystd__set__lt__float__gt__Iter),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_Pystd__set__lt__float__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__set__lt__float__gt__Iter__tp_traverse,     /* tp_traverse */
    (inquiry)Pystd__set__lt__float__gt__Iter__tp_clear,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_Pystd__set__lt__float__gt__Iter__tp_iter,          /* tp_iter */
    (iternextfunc)_wrap_Pystd__set__lt__float__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
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 *) "foo.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 *) "foo.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
Pystd__vector__lt__std__string__gt__Iter__tp_clear(Pystd__vector__lt__std__string__gt__Iter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

}


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


static void
_wrap_Pystd__vector__lt__std__string__gt____tp_dealloc(Pystd__vector__lt__std__string__gt__ *self)
{
    delete self->obj;
    self->obj = NULL;

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


static void
_wrap_Pystd__vector__lt__std__string__gt__Iter__tp_dealloc(Pystd__vector__lt__std__string__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__std__string__gt____tp_iter(Pystd__vector__lt__std__string__gt__ *self)
{
    Pystd__vector__lt__std__string__gt__Iter *iter = PyObject_GC_New(Pystd__vector__lt__std__string__gt__Iter, &Pystd__vector__lt__std__string__gt__Iter_Type);
    Py_INCREF(self);
    iter->container = self;
    iter->iterator = new std::vector<std::string>::iterator(self->obj->begin());
    return (PyObject*) iter;
}


static PyObject*
_wrap_Pystd__vector__lt__std__string__gt__Iter__tp_iter(Pystd__vector__lt__std__string__gt__Iter *self)
{
    Py_INCREF(self);
    return (PyObject*) self;
}

static PyObject* _wrap_Pystd__vector__lt__std__string__gt__Iter__tp_iternext(Pystd__vector__lt__std__string__gt__Iter *self)
{
    PyObject *py_retval;
    std::vector<std::string>::iterator iter;

    iter = *self->iterator;
    if (iter == self->container->obj->end()) {
        PyErr_SetNone(PyExc_StopIteration);
        return NULL;
    }
    ++(*self->iterator);
    py_retval = Py_BuildValue((char *) "s#", ((*iter)).c_str(), ((*iter)).size());
    return py_retval;
}

int _wrap_convert_py2c__std__string(PyObject *value, std::string *address)
{
    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 0;
    }
    *address = std::string(retval_ptr, retval_len);
    Py_DECREF(py_retval);
    return 1;
}


int _wrap_convert_py2c__std__vector__lt___std__string___gt__(PyObject *arg, std::vector<std::string> *container)
{
    if (PyObject_IsInstance(arg, (PyObject*) &Pystd__vector__lt__std__string__gt___Type)) {
        *container = *((Pystd__vector__lt__std__string__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++) {
            std::string item;
            if (!_wrap_convert_py2c__std__string(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__std__string__gt__ instance, or a list of std::string");
        return 0;
    }
    return 1;
}


static int
_wrap_Pystd__vector__lt__std__string__gt____tp_init(Pystd__vector__lt__std__string__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<std::string>;

    if (arg == NULL)
        return 0;

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

PyTypeObject Pystd__vector__lt__std__string__gt___Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.Std__vector__lt__std__string__gt__",            /* tp_name */
    sizeof(Pystd__vector__lt__std__string__gt__),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_Pystd__vector__lt__std__string__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__std__string__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__std__string__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__std__string__gt__Iter_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.Std__vector__lt__std__string__gt__Iter",            /* tp_name */
    sizeof(Pystd__vector__lt__std__string__gt__Iter),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_Pystd__vector__lt__std__string__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__std__string__gt__Iter__tp_traverse,     /* tp_traverse */
    (inquiry)Pystd__vector__lt__std__string__gt__Iter__tp_clear,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_Pystd__vector__lt__std__string__gt__Iter__tp_iter,          /* tp_iter */
    (iternextfunc)_wrap_Pystd__vector__lt__std__string__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
Pystd__map__lt__std__string__simple_struct_t__gt__Iter__tp_clear(Pystd__map__lt__std__string__simple_struct_t__gt__Iter *self)
{
    Py_CLEAR(self->container);
    delete self->iterator;
    self->iterator = NULL;

}


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


static void
_wrap_Pystd__map__lt__std__string__simple_struct_t__gt____tp_dealloc(Pystd__map__lt__std__string__simple_struct_t__gt__ *self)
{
    delete self->obj;
    self->obj = NULL;

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


static void
_wrap_Pystd__map__lt__std__string__simple_struct_t__gt__Iter__tp_dealloc(Pystd__map__lt__std__string__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__map__lt__std__string__simple_struct_t__gt____tp_iter(Pystd__map__lt__std__string__simple_struct_t__gt__ *self)
{
    Pystd__map__lt__std__string__simple_struct_t__gt__Iter *iter = PyObject_GC_New(Pystd__map__lt__std__string__simple_struct_t__gt__Iter, &Pystd__map__lt__std__string__simple_struct_t__gt__Iter_Type);
    Py_INCREF(self);
    iter->container = self;
    iter->iterator = new std::map<std::string, simple_struct_t>::iterator(self->obj->begin());
    return (PyObject*) iter;
}


static PyObject*
_wrap_Pystd__map__lt__std__string__simple_struct_t__gt__Iter__tp_iter(Pystd__map__lt__std__string__simple_struct_t__gt__Iter *self)
{
    Py_INCREF(self);
    return (PyObject*) self;
}

static PyObject* _wrap_Pystd__map__lt__std__string__simple_struct_t__gt__Iter__tp_iternext(Pystd__map__lt__std__string__simple_struct_t__gt__Iter *self)
{
    PyObject *py_retval;
    std::map<std::string, 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->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__std__map__lt___std__string__simple_struct_t___gt__(PyObject *arg, std::map<std::string, simple_struct_t> *container)
{
    if (PyObject_IsInstance(arg, (PyObject*) &Pystd__map__lt__std__string__simple_struct_t__gt___Type)) {
        *container = *((Pystd__map__lt__std__string__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++) {
            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 Std__map__lt__std__string__simple_struct_t__gt__ instance, or a list of simple_struct_t");
        return 0;
    }
    return 1;
}


static int
_wrap_Pystd__map__lt__std__string__simple_struct_t__gt____tp_init(Pystd__map__lt__std__string__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::map<std::string, simple_struct_t>;

    if (arg == NULL)
        return 0;

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

PyTypeObject Pystd__map__lt__std__string__simple_struct_t__gt___Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.Std__map__lt__std__string__simple_struct_t__gt__",            /* tp_name */
    sizeof(Pystd__map__lt__std__string__simple_struct_t__gt__),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_Pystd__map__lt__std__string__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__map__lt__std__string__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__map__lt__std__string__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__map__lt__std__string__simple_struct_t__gt__Iter_Type = {
    PyObject_HEAD_INIT(NULL)
    0,                                 /* ob_size */
    (char *) "foo.Std__map__lt__std__string__simple_struct_t__gt__Iter",            /* tp_name */
    sizeof(Pystd__map__lt__std__string__simple_struct_t__gt__Iter),                  /* tp_basicsize */
    0,                                 /* tp_itemsize */
    /* methods */
    (destructor)_wrap_Pystd__map__lt__std__string__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__map__lt__std__string__simple_struct_t__gt__Iter__tp_traverse,     /* tp_traverse */
    (inquiry)Pystd__map__lt__std__string__simple_struct_t__gt__Iter__tp_clear,             /* tp_clear */
    (richcmpfunc)NULL,   /* tp_richcompare */
    0,             /* tp_weaklistoffset */
    (getiterfunc)_wrap_Pystd__map__lt__std__string__simple_struct_t__gt__Iter__tp_iter,          /* tp_iter */
    (iternextfunc)_wrap_Pystd__map__lt__std__string__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 */
};


/* --- exceptions --- */


PyTypeObject *PyError_Type;


PyTypeObject *PyDomainError_Type;


PyTypeObject *Pystd__exception_Type;

/* --- enumerations --- */







PyMODINIT_FUNC
#if defined(__GNUC__) && __GNUC__ >= 4
__attribute__ ((visibility("default")))
#endif
initfoo(void)
{
    PyObject *m;
    PyObject *submodule;
    m = Py_InitModule3((char *) "foo", foo_functions, NULL);
    if (m == NULL) {
        return;
    }
    PyFoo__typeid_map.register_wrapper(typeid(Foo), &PyFoo_Type);
    PyZoo__typeid_map.register_wrapper(typeid(Zoo), &PyZoo_Type);
    PyFoo__typeid_map.register_wrapper(typeid(Bar), &PyBar_Type);
    PySomeObjectNestedClass__typeid_map.register_wrapper(typeid(SomeObject::NestedClass), &PySomeObjectNestedClass_Type);
    /* Register the 'Foo' class */

    PyFooMeta_Type.tp_base = PyBaseObject_Type.ob_type;
    /* Some fields need to be manually inheritted from the parent metaclass */
    PyFooMeta_Type.tp_traverse = PyBaseObject_Type.ob_type->tp_traverse;
    PyFooMeta_Type.tp_clear = PyBaseObject_Type.ob_type->tp_clear;
    PyFooMeta_Type.tp_is_gc = PyBaseObject_Type.ob_type->tp_is_gc;
    /* PyType tp_setattro is too restrictive */
    PyFooMeta_Type.tp_setattro = PyObject_GenericSetAttr;
    PyType_Ready(&PyFooMeta_Type);

    PyFoo_Type.ob_type = &PyFooMeta_Type;
    if (PyType_Ready(&PyFoo_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Foo", (PyObject *) &PyFoo_Type);
    /* Register the 'Zoo' class */
    if (PyType_Ready(&PyZoo_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Zoo", (PyObject *) &PyZoo_Type);
    /* Register the 'Foobar' class */

    PyFoobarMeta_Type.tp_base = PyBaseObject_Type.ob_type;
    /* Some fields need to be manually inheritted from the parent metaclass */
    PyFoobarMeta_Type.tp_traverse = PyBaseObject_Type.ob_type->tp_traverse;
    PyFoobarMeta_Type.tp_clear = PyBaseObject_Type.ob_type->tp_clear;
    PyFoobarMeta_Type.tp_is_gc = PyBaseObject_Type.ob_type->tp_is_gc;
    /* PyType tp_setattro is too restrictive */
    PyFoobarMeta_Type.tp_setattro = PyObject_GenericSetAttr;
    PyType_Ready(&PyFoobarMeta_Type);

    PyFoobar_Type.ob_type = &PyFoobarMeta_Type;
    if (PyType_Ready(&PyFoobar_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Foobar", (PyObject *) &PyFoobar_Type);
    /* Register the 'Bar' class */
    PyBar_Type.tp_base = &PyFoo_Type;
    if (PyType_Ready(&PyBar_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Bar", (PyObject *) &PyBar_Type);
    /* Register the 'Zbr' class */

    PyZbrMeta_Type.tp_base = PyBaseObject_Type.ob_type;
    /* Some fields need to be manually inheritted from the parent metaclass */
    PyZbrMeta_Type.tp_traverse = PyBaseObject_Type.ob_type->tp_traverse;
    PyZbrMeta_Type.tp_clear = PyBaseObject_Type.ob_type->tp_clear;
    PyZbrMeta_Type.tp_is_gc = PyBaseObject_Type.ob_type->tp_is_gc;
    /* PyType tp_setattro is too restrictive */
    PyZbrMeta_Type.tp_setattro = PyObject_GenericSetAttr;
    PyType_Ready(&PyZbrMeta_Type);

    PyZbr_Type.ob_type = &PyZbrMeta_Type;
    if (PyType_Ready(&PyZbr_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Zbr", (PyObject *) &PyZbr_Type);
    /* Register the 'SomeObject' class */

    PySomeObjectMeta_Type.tp_base = PyBaseObject_Type.ob_type;
    /* Some fields need to be manually inheritted from the parent metaclass */
    PySomeObjectMeta_Type.tp_traverse = PyBaseObject_Type.ob_type->tp_traverse;
    PySomeObjectMeta_Type.tp_clear = PyBaseObject_Type.ob_type->tp_clear;
    PySomeObjectMeta_Type.tp_is_gc = PyBaseObject_Type.ob_type->tp_is_gc;
    /* PyType tp_setattro is too restrictive */
    PySomeObjectMeta_Type.tp_setattro = PyObject_GenericSetAttr;
    PyType_Ready(&PySomeObjectMeta_Type);

    PySomeObject_Type.ob_type = &PySomeObjectMeta_Type;
    if (PyType_Ready(&PySomeObject_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "SomeObject", (PyObject *) &PySomeObject_Type);
    /* Register the 'ClassThatTakesFoo' class */
    if (PyType_Ready(&PyClassThatTakesFoo_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "ClassThatTakesFoo", (PyObject *) &PyClassThatTakesFoo_Type);
    /* Register the 'SingletonClass' class */
    if (PyType_Ready(&PySingletonClass_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "SingletonClass", (PyObject *) &PySingletonClass_Type);
    /* Register the 'InterfaceId' class */
    if (PyType_Ready(&PyInterfaceId_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "InterfaceId", (PyObject *) &PyInterfaceId_Type);
    /* Register the 'CannotBeConstructed' class */
    if (PyType_Ready(&PyCannotBeConstructed_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "CannotBeConstructed", (PyObject *) &PyCannotBeConstructed_Type);
    /* Register the 'SomeObject::NestedClass' class */

    PySomeObjectNestedClassMeta_Type.tp_base = PyBaseObject_Type.ob_type;
    /* Some fields need to be manually inheritted from the parent metaclass */
    PySomeObjectNestedClassMeta_Type.tp_traverse = PyBaseObject_Type.ob_type->tp_traverse;
    PySomeObjectNestedClassMeta_Type.tp_clear = PyBaseObject_Type.ob_type->tp_clear;
    PySomeObjectNestedClassMeta_Type.tp_is_gc = PyBaseObject_Type.ob_type->tp_is_gc;
    /* PyType tp_setattro is too restrictive */
    PySomeObjectNestedClassMeta_Type.tp_setattro = PyObject_GenericSetAttr;
    PyType_Ready(&PySomeObjectNestedClassMeta_Type);

    PySomeObjectNestedClass_Type.ob_type = &PySomeObjectNestedClassMeta_Type;
    if (PyType_Ready(&PySomeObjectNestedClass_Type)) {
        return;
    }
    PyDict_SetItemString((PyObject*) PySomeObject_Type.tp_dict, (char *) "NestedClass", (PyObject *) &PySomeObjectNestedClass_Type);
    /* Register the 'AbstractBaseClass2' class */
    if (PyType_Ready(&PyAbstractBaseClass2_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "AbstractBaseClass2", (PyObject *) &PyAbstractBaseClass2_Type);
    /* Register the 'AbstractXpto' class */
    if (PyType_Ready(&PyAbstractXpto_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "AbstractXpto", (PyObject *) &PyAbstractXpto_Type);
    /* Register the 'AbstractXptoImpl' class */
    PyAbstractXptoImpl_Type.tp_base = &PyAbstractXpto_Type;
    if (PyType_Ready(&PyAbstractXptoImpl_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "AbstractXptoImpl", (PyObject *) &PyAbstractXptoImpl_Type);
    /* Register the 'Word' class */
    if (PyType_Ready(&PyWord_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Word", (PyObject *) &PyWord_Type);
    /* Register the 'Socket' class */
    if (PyType_Ready(&PySocket_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Socket", (PyObject *) &PySocket_Type);
    /* Register the 'UdpSocket' class */
    PyUdpSocket_Type.tp_base = &PySocket_Type;
    if (PyType_Ready(&PyUdpSocket_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "UdpSocket", (PyObject *) &PyUdpSocket_Type);
    /* Register the 'simple_struct_t' class */
    if (PyType_Ready(&PySimple_struct_t_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "simple_struct_t", (PyObject *) &PySimple_struct_t_Type);
    /* Register the 'TestContainer' class */
    if (PyType_Ready(&PyTestContainer_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "TestContainer", (PyObject *) &PyTestContainer_Type);
    /* Register the 'Tupl' class */
    if (PyType_Ready(&PyTupl_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Tupl", (PyObject *) &PyTupl_Type);
    /* Register the 'ManipulatedObject' class */
    if (PyType_Ready(&PyManipulatedObject_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "ManipulatedObject", (PyObject *) &PyManipulatedObject_Type);
    /* Register the 'ReferenceManipulator' class */
    if (PyType_Ready(&PyReferenceManipulator_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "ReferenceManipulator", (PyObject *) &PyReferenceManipulator_Type);
    /* Register the 'VectorLike' class */
    if (PyType_Ready(&PyVectorLike_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "VectorLike", (PyObject *) &PyVectorLike_Type);
    /* Register the 'VectorLike2' class */
    if (PyType_Ready(&PyVectorLike2_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "VectorLike2", (PyObject *) &PyVectorLike2_Type);
    /* Register the 'VectorLike2' class iterator*/
    if (PyType_Ready(&PyVectorLike2_IterType)) {
        return;
    }
    PyModule_AddObject(m, (char *) "VectorLike2Iter", (PyObject *) &PyVectorLike2_IterType);
    /* Register the 'MapLike' class */
    if (PyType_Ready(&PyMapLike_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "MapLike", (PyObject *) &PyMapLike_Type);
    /* Register the 'MapLike' class iterator*/
    if (PyType_Ready(&PyMapLike_IterType)) {
        return;
    }
    PyModule_AddObject(m, (char *) "MapLikeIter", (PyObject *) &PyMapLike_IterType);
    /* Register the 'ClassThatThrows' class */
    if (PyType_Ready(&PyClassThatThrows_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "ClassThatThrows", (PyObject *) &PyClassThatThrows_Type);
    /* Register the 'ProtectedConstructor' class */
    if (PyType_Ready(&PyProtectedConstructor_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "ProtectedConstructor", (PyObject *) &PyProtectedConstructor_Type);
    /* Register the 'property< std::string >' class */
    if (PyType_Ready(&PyProperty__StdString_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Property__StdString", (PyObject *) &PyProperty__StdString_Type);
    /* Register the 'Box' class */

    PyBoxMeta_Type.tp_base = PyBaseObject_Type.ob_type;
    /* Some fields need to be manually inheritted from the parent metaclass */
    PyBoxMeta_Type.tp_traverse = PyBaseObject_Type.ob_type->tp_traverse;
    PyBoxMeta_Type.tp_clear = PyBaseObject_Type.ob_type->tp_clear;
    PyBoxMeta_Type.tp_is_gc = PyBaseObject_Type.ob_type->tp_is_gc;
    /* PyType tp_setattro is too restrictive */
    PyBoxMeta_Type.tp_setattro = PyObject_GenericSetAttr;
    PyType_Ready(&PyBoxMeta_Type);

    PyBox_Type.ob_type = &PyBoxMeta_Type;
    if (PyType_Ready(&PyBox_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Box", (PyObject *) &PyBox_Type);
    /* Register the 'MIRoot' class */
    if (PyType_Ready(&PyMIRoot_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "MIRoot", (PyObject *) &PyMIRoot_Type);
    /* Register the 'MIBase1' class */
    PyMIBase1_Type.tp_base = &PyMIRoot_Type;
    if (PyType_Ready(&PyMIBase1_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "MIBase1", (PyObject *) &PyMIBase1_Type);
    /* Register the 'MIBase2' class */
    PyMIBase2_Type.tp_base = &PyMIRoot_Type;
    if (PyType_Ready(&PyMIBase2_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "MIBase2", (PyObject *) &PyMIBase2_Type);
    /* Register the 'MIMixed' class */
    PyMIMixed_Type.tp_base = &PyMIBase1_Type;
    PyMIMixed_Type.tp_bases = PyTuple_New(2);
        Py_INCREF((PyObject *) &PyMIBase1_Type);
        PyTuple_SET_ITEM(PyMIMixed_Type.tp_bases, 0, (PyObject *) &PyMIBase1_Type);
        Py_INCREF((PyObject *) &PyMIBase2_Type);
        PyTuple_SET_ITEM(PyMIMixed_Type.tp_bases, 1, (PyObject *) &PyMIBase2_Type);
    if (PyType_Ready(&PyMIMixed_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "MIMixed", (PyObject *) &PyMIMixed_Type);
    /* Register the 'SimpleStructList' class */
    if (PyType_Ready(&PySimpleStructList_Type)) {
        return;
    }
    if (PyType_Ready(&PySimpleStructListIter_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "SimpleStructList", (PyObject *) &PySimpleStructList_Type);
    PyModule_AddObject(m, (char *) "SimpleStructListIter", (PyObject *) &PySimpleStructListIter_Type);
    /* Register the 'std::set<float>' class */
    if (PyType_Ready(&Pystd__set__lt__float__gt___Type)) {
        return;
    }
    if (PyType_Ready(&Pystd__set__lt__float__gt__Iter_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Std__set__lt__float__gt__", (PyObject *) &Pystd__set__lt__float__gt___Type);
    PyModule_AddObject(m, (char *) "Std__set__lt__float__gt__Iter", (PyObject *) &Pystd__set__lt__float__gt__Iter_Type);
    /* Register the 'std::vector<simple_struct_t>' class */
    if (PyType_Ready(&Pystd__vector__lt__simple_struct_t__gt___Type)) {
        return;
    }
    if (PyType_Ready(&Pystd__vector__lt__simple_struct_t__gt__Iter_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Std__vector__lt__simple_struct_t__gt__", (PyObject *) &Pystd__vector__lt__simple_struct_t__gt___Type);
    PyModule_AddObject(m, (char *) "Std__vector__lt__simple_struct_t__gt__Iter", (PyObject *) &Pystd__vector__lt__simple_struct_t__gt__Iter_Type);
    /* Register the 'std::vector<std::string>' class */
    if (PyType_Ready(&Pystd__vector__lt__std__string__gt___Type)) {
        return;
    }
    if (PyType_Ready(&Pystd__vector__lt__std__string__gt__Iter_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Std__vector__lt__std__string__gt__", (PyObject *) &Pystd__vector__lt__std__string__gt___Type);
    PyModule_AddObject(m, (char *) "Std__vector__lt__std__string__gt__Iter", (PyObject *) &Pystd__vector__lt__std__string__gt__Iter_Type);
    /* Register the 'std::map<std::string, simple_struct_t>' class */
    if (PyType_Ready(&Pystd__map__lt__std__string__simple_struct_t__gt___Type)) {
        return;
    }
    if (PyType_Ready(&Pystd__map__lt__std__string__simple_struct_t__gt__Iter_Type)) {
        return;
    }
    PyModule_AddObject(m, (char *) "Std__map__lt__std__string__simple_struct_t__gt__", (PyObject *) &Pystd__map__lt__std__string__simple_struct_t__gt___Type);
    PyModule_AddObject(m, (char *) "Std__map__lt__std__string__simple_struct_t__gt__Iter", (PyObject *) &Pystd__map__lt__std__string__simple_struct_t__gt__Iter_Type);
    /* Register the 'Error' exception */
    if ((PyError_Type = (PyTypeObject*) PyErr_NewException((char*)"foo.Error", NULL, NULL)) == NULL) {
        return;
    }
    Py_INCREF((PyObject *) PyError_Type);
    PyModule_AddObject(m, (char *) "Error", (PyObject *) PyError_Type);
    /* Register the 'DomainError' exception */
    if ((PyDomainError_Type = (PyTypeObject*) PyErr_NewException((char*)"foo.DomainError", (PyObject*) PyError_Type, NULL)) == NULL) {
        return;
    }
    Py_INCREF((PyObject *) PyDomainError_Type);
    PyModule_AddObject(m, (char *) "DomainError", (PyObject *) PyDomainError_Type);
    /* Register the 'std::exception' exception */
    if ((Pystd__exception_Type = (PyTypeObject*) PyErr_NewException((char*)"foo.exception", NULL, NULL)) == NULL) {
        return;
    }
    Py_INCREF((PyObject *) Pystd__exception_Type);
    PyModule_AddObject(m, (char *) "exception", (PyObject *) Pystd__exception_Type);
    {
        PyObject *tmp_value;
         // SomeObject::FOO_TYPE_AAA
        tmp_value = PyInt_FromLong(SomeObject::FOO_TYPE_AAA);
        PyDict_SetItemString((PyObject*) PySomeObject_Type.tp_dict, "FOO_TYPE_AAA", tmp_value);
        Py_DECREF(tmp_value);
         // SomeObject::FOO_TYPE_BBB
        tmp_value = PyInt_FromLong(SomeObject::FOO_TYPE_BBB);
        PyDict_SetItemString((PyObject*) PySomeObject_Type.tp_dict, "FOO_TYPE_BBB", tmp_value);
        Py_DECREF(tmp_value);
         // SomeObject::FOO_TYPE_CCC
        tmp_value = PyInt_FromLong(SomeObject::FOO_TYPE_CCC);
        PyDict_SetItemString((PyObject*) PySomeObject_Type.tp_dict, "FOO_TYPE_CCC", tmp_value);
        Py_DECREF(tmp_value);
    }
    {
        PyObject *tmp_value;
         // SomeObject::CONSTANT_A
        tmp_value = PyInt_FromLong(SomeObject::CONSTANT_A);
        PyDict_SetItemString((PyObject*) PySomeObject_Type.tp_dict, "CONSTANT_A", tmp_value);
        Py_DECREF(tmp_value);
         // SomeObject::CONSTANT_B
        tmp_value = PyInt_FromLong(SomeObject::CONSTANT_B);
        PyDict_SetItemString((PyObject*) PySomeObject_Type.tp_dict, "CONSTANT_B", tmp_value);
        Py_DECREF(tmp_value);
         // SomeObject::CONSTANT_C
        tmp_value = PyInt_FromLong(SomeObject::CONSTANT_C);
        PyDict_SetItemString((PyObject*) PySomeObject_Type.tp_dict, "CONSTANT_C", tmp_value);
        Py_DECREF(tmp_value);
    }
    submodule = initfoo_xpto();
    if (submodule == NULL) {
        return;
    }
    Py_INCREF(submodule);
    PyModule_AddObject(m, (char *) "xpto", submodule);
    submodule = initfoo_TopNs();
    if (submodule == NULL) {
        return;
    }
    Py_INCREF(submodule);
    PyModule_AddObject(m, (char *) "TopNs", submodule);
}
