/* Generated by Cython 0.15.1 on Sun Mar  4 02:13:27 2012 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#else

#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif

#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif

#if PY_VERSION_HEX < 0x02040000
  #define METH_COEXIST 0
  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
  #define PyDict_Contains(d,o)   PySequence_Contains(d,o)
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)

#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif

#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)

#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif

#if PY_VERSION_HEX < 0x03020000
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__osmium__examples
#define __PYX_HAVE_API__osmium__examples
#include <string>
#include "osmium.hpp"
#include "stdint.h"
#include "time.h"
#include "osmium/osm/types.hpp"
#include "osmium/osm/tag.hpp"
#include "osmium/osm/tag_list.hpp"
#include "ios"
#include "new"
#include "stdexcept"
#include "typeinfo"
#include "osmium/osm/position.hpp"
#include "osmium/osm/bounds.hpp"
#include "osmium/osm/meta.hpp"
#include "osmium/osm/object.hpp"
#include "osmium/osm/node.hpp"
#include "osmium/osm/way_node.hpp"
#include "osmium/osm/way_node_list.hpp"
#include "osmium/osm/way.hpp"
#include "osmium/osm/relation_member.hpp"
#include "osmium/osm/relation_member_list.hpp"
#include "osmium/osm/relation.hpp"
#include "osmium/osm/area.hpp"
#include "osmium/handler.hpp"
#include "osmium/handler/debug.hpp"
#include "osmium/handler/progress.hpp"
#include "osmium/output.hpp"
#include "osmium/osmfile.hpp"
#include "pyerrors.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || defined(__INTEL_COMPILER)
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))


#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "examples.pyx",
  "osm.pxd",
  "handler.pxd",
};

/*--- Type declarations ---*/
struct __pyx_obj_6osmium_3osm_TagList;
struct __pyx_obj_6osmium_3osm_WayNodeList;
struct __pyx_obj_6osmium_3osm_Object;
struct __pyx_obj_6osmium_3osm_Node;
struct StopReading_struct;
struct osmhandler_struct;
struct __pyx_obj_6osmium_7handler_Tee;
struct __pyx_obj_6osmium_3osm_Meta;
struct __pyx_obj_6osmium_3osm_Relation;
struct __pyx_obj_6osmium_7handler_Debug;
struct __pyx_obj_6osmium_3osm_RelationMemberList;
struct __pyx_obj_6osmium_7handler_Forward;
struct __pyx_obj_6osmium_8examples_ExampleHandler;
struct __pyx_obj_6osmium_3osm_Bounds;
struct __pyx_obj_6osmium_7handler_Progress;
struct __pyx_obj_6osmium_3osm_Way;

/* "osmium/osm.pxd":3
 * from c_osmium.osm cimport TagList as c_TagList, ObjectPtr, WayPtr, RelationPtr, Meta as c_Meta, Bounds as c_Bounds
 * 
 * cdef class TagList:             # <<<<<<<<<<<<<<
 *     cdef ObjectPtr *c_object
 * 
 */
struct __pyx_obj_6osmium_3osm_TagList {
  PyObject_HEAD
  shared_ptr<const Osmium::OSM::Object> *c_object;
};


/* "osmium/osm.pxd":6
 *     cdef ObjectPtr *c_object
 * 
 * cdef class WayNodeList:             # <<<<<<<<<<<<<<
 *     cdef WayPtr *c_way
 * 
 */
struct __pyx_obj_6osmium_3osm_WayNodeList {
  PyObject_HEAD
  shared_ptr<const Osmium::OSM::Way> *c_way;
};


/* "osmium/osm.pxd":12
 *     cdef RelationPtr *c_relation
 * 
 * cdef class Object:             # <<<<<<<<<<<<<<
 *     """Base class for OSM objects
 * 
 */
struct __pyx_obj_6osmium_3osm_Object {
  PyObject_HEAD
  shared_ptr<const Osmium::OSM::Object> *c_object;
};


/* "osmium/osm.pxd":19
 *     cdef ObjectPtr *c_object
 * 
 * cdef class Node(Object):             # <<<<<<<<<<<<<<
 *     """OSM Node object
 * 
 */
struct __pyx_obj_6osmium_3osm_Node {
  struct __pyx_obj_6osmium_3osm_Object __pyx_base;
};


/* "osmium/handler.pxd":11
 *         pass
 * 
 * cdef public class StopReading(Exception) [object StopReading_struct, type StopReading_type]:             # <<<<<<<<<<<<<<
 *     """raise this exception to immediately stop reading the input file
 *     """
 */
struct StopReading_struct {
  PyBaseExceptionObject __pyx_base;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) StopReading_type;

/* "osmium/handler.pxd":16
 *     pass
 * 
 * cdef public class Base[object osmhandler_struct, type osmhandler_type]:             # <<<<<<<<<<<<<<
 *     """base class for python implemented handlers
 *     """
 */
struct osmhandler_struct {
  PyObject_HEAD
  struct __pyx_vtabstruct_6osmium_7handler_Base *__pyx_vtab;
  struct __pyx_obj_6osmium_3osm_Node *cur_node;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) osmhandler_type;

/* "osmium/handler.pxd":42
 *     cpdef show_cursor(self)
 * 
 * cdef class Tee(Base):             # <<<<<<<<<<<<<<
 *     cdef public Base handler1
 *     cdef public Base handler2
 */
struct __pyx_obj_6osmium_7handler_Tee {
  struct osmhandler_struct __pyx_base;
  struct osmhandler_struct *handler1;
  struct osmhandler_struct *handler2;
};


/* "osmium/osm.pxd":40
 * 
 * 
 * cdef class Meta:             # <<<<<<<<<<<<<<
 *     """Meta information from the header of an OSM file.
 *     """
 */
struct __pyx_obj_6osmium_3osm_Meta {
  PyObject_HEAD
  struct __pyx_vtabstruct_6osmium_3osm_Meta *__pyx_vtab;
  Osmium::OSM::Meta *c_meta;
  struct __pyx_obj_6osmium_3osm_Bounds *bounds;
};


/* "osmium/osm.pxd":31
 *     pass
 * 
 * cdef class Relation(Object):             # <<<<<<<<<<<<<<
 *     """OSM Relation object
 *     """
 */
struct __pyx_obj_6osmium_3osm_Relation {
  struct __pyx_obj_6osmium_3osm_Object __pyx_base;
};


/* "osmium/handler.pxd":34
 *     cpdef final(self)
 * 
 * cdef class Debug(Base):             # <<<<<<<<<<<<<<
 *     cdef c_Debug *c_handler
 * 
 */
struct __pyx_obj_6osmium_7handler_Debug {
  struct osmhandler_struct __pyx_base;
  Osmium::Handler::Debug *c_handler;
};


/* "osmium/osm.pxd":9
 *     cdef WayPtr *c_way
 * 
 * cdef class RelationMemberList:             # <<<<<<<<<<<<<<
 *     cdef RelationPtr *c_relation
 * 
 */
struct __pyx_obj_6osmium_3osm_RelationMemberList {
  PyObject_HEAD
  shared_ptr<const Osmium::OSM::Relation> *c_relation;
};


/* "osmium/handler.pxd":46
 *     cdef public Base handler2
 * 
 * cdef class Forward(Base):             # <<<<<<<<<<<<<<
 *     cdef public Base handler
 */
struct __pyx_obj_6osmium_7handler_Forward {
  struct osmhandler_struct __pyx_base;
  struct osmhandler_struct *handler;
};


/* "osmium/examples.pyx":33
 *     python_handler.handle_infile(infile)
 * 
 * cdef class ExampleHandler(osmhandler):             # <<<<<<<<<<<<<<
 *     cdef public Node saved_node
 *     cdef public Way saved_way
 */
struct __pyx_obj_6osmium_8examples_ExampleHandler {
  struct osmhandler_struct __pyx_base;
  struct __pyx_obj_6osmium_3osm_Node *saved_node;
  struct __pyx_obj_6osmium_3osm_Way *saved_way;
  struct __pyx_obj_6osmium_3osm_Relation *saved_relation;
};


/* "osmium/osm.pxd":36
 *     pass
 * 
 * cdef class Bounds:             # <<<<<<<<<<<<<<
 *     cdef c_Bounds* c_bounds
 * 
 */
struct __pyx_obj_6osmium_3osm_Bounds {
  PyObject_HEAD
  Osmium::OSM::Bounds *c_bounds;
};


/* "osmium/handler.pxd":37
 *     cdef c_Debug *c_handler
 * 
 * cdef class Progress(Base):             # <<<<<<<<<<<<<<
 *     cdef c_Progress *c_handler
 *     cpdef hide_cursor(self)
 */
struct __pyx_obj_6osmium_7handler_Progress {
  struct osmhandler_struct __pyx_base;
  Osmium::Handler::Progress *c_handler;
};


/* "osmium/osm.pxd":26
 *     pass
 * 
 * cdef class Way(Object):             # <<<<<<<<<<<<<<
 *     """OSM Way object
 *     """
 */
struct __pyx_obj_6osmium_3osm_Way {
  struct __pyx_obj_6osmium_3osm_Object __pyx_base;
};



/* "osmium/osm.pxd":40
 * 
 * 
 * cdef class Meta:             # <<<<<<<<<<<<<<
 *     """Meta information from the header of an OSM file.
 *     """
 */

struct __pyx_vtabstruct_6osmium_3osm_Meta {
  PyObject *(*set_from_c)(struct __pyx_obj_6osmium_3osm_Meta *, Osmium::OSM::Meta &);
};
static struct __pyx_vtabstruct_6osmium_3osm_Meta *__pyx_vtabptr_6osmium_3osm_Meta;

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) osmhandler_type;

/* "osmium/handler.pxd":16
 *     pass
 * 
 * cdef public class Base[object osmhandler_struct, type osmhandler_type]:             # <<<<<<<<<<<<<<
 *     """base class for python implemented handlers
 *     """
 */

struct __pyx_vtabstruct_6osmium_7handler_Base {
  PyObject *(*handle_infile)(struct osmhandler_struct *, Osmium::OSMFile *);
  PyObject *(*init)(struct osmhandler_struct *, struct __pyx_obj_6osmium_3osm_Meta *, int __pyx_skip_dispatch);
  PyObject *(*before_nodes)(struct osmhandler_struct *, int __pyx_skip_dispatch);
  PyObject *(*node)(struct osmhandler_struct *, struct __pyx_obj_6osmium_3osm_Node *, int __pyx_skip_dispatch);
  PyObject *(*after_nodes)(struct osmhandler_struct *, int __pyx_skip_dispatch);
  PyObject *(*before_ways)(struct osmhandler_struct *, int __pyx_skip_dispatch);
  PyObject *(*way)(struct osmhandler_struct *, struct __pyx_obj_6osmium_3osm_Way *, int __pyx_skip_dispatch);
  PyObject *(*after_ways)(struct osmhandler_struct *, int __pyx_skip_dispatch);
  PyObject *(*before_relations)(struct osmhandler_struct *, int __pyx_skip_dispatch);
  PyObject *(*relation)(struct osmhandler_struct *, struct __pyx_obj_6osmium_3osm_Relation *, int __pyx_skip_dispatch);
  PyObject *(*after_relations)(struct osmhandler_struct *, int __pyx_skip_dispatch);
  PyObject *(*final)(struct osmhandler_struct *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6osmium_7handler_Base *__pyx_vtabptr_6osmium_7handler_Base;


/* "osmium/handler.pxd":37
 *     cdef c_Debug *c_handler
 * 
 * cdef class Progress(Base):             # <<<<<<<<<<<<<<
 *     cdef c_Progress *c_handler
 *     cpdef hide_cursor(self)
 */

struct __pyx_vtabstruct_6osmium_7handler_Progress {
  struct __pyx_vtabstruct_6osmium_7handler_Base __pyx_base;
  PyObject *(*hide_cursor)(struct __pyx_obj_6osmium_7handler_Progress *, int __pyx_skip_dispatch);
  PyObject *(*show_cursor)(struct __pyx_obj_6osmium_7handler_Progress *, int __pyx_skip_dispatch);
};
static struct __pyx_vtabstruct_6osmium_7handler_Progress *__pyx_vtabptr_6osmium_7handler_Progress;


/* "osmium/examples.pyx":33
 *     python_handler.handle_infile(infile)
 * 
 * cdef class ExampleHandler(osmhandler):             # <<<<<<<<<<<<<<
 *     cdef public Node saved_node
 *     cdef public Way saved_way
 */

struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler {
  struct __pyx_vtabstruct_6osmium_7handler_Base __pyx_base;
};
static struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *__pyx_vtabptr_6osmium_8examples_ExampleHandler;


/* "osmium/handler.pxd":46
 *     cdef public Base handler2
 * 
 * cdef class Forward(Base):             # <<<<<<<<<<<<<<
 *     cdef public Base handler
 */

struct __pyx_vtabstruct_6osmium_7handler_Forward {
  struct __pyx_vtabstruct_6osmium_7handler_Base __pyx_base;
};
static struct __pyx_vtabstruct_6osmium_7handler_Forward *__pyx_vtabptr_6osmium_7handler_Forward;


/* "osmium/handler.pxd":34
 *     cpdef final(self)
 * 
 * cdef class Debug(Base):             # <<<<<<<<<<<<<<
 *     cdef c_Debug *c_handler
 * 
 */

struct __pyx_vtabstruct_6osmium_7handler_Debug {
  struct __pyx_vtabstruct_6osmium_7handler_Base __pyx_base;
};
static struct __pyx_vtabstruct_6osmium_7handler_Debug *__pyx_vtabptr_6osmium_7handler_Debug;


/* "osmium/handler.pxd":42
 *     cpdef show_cursor(self)
 * 
 * cdef class Tee(Base):             # <<<<<<<<<<<<<<
 *     cdef public Base handler1
 *     cdef public Base handler2
 */

struct __pyx_vtabstruct_6osmium_7handler_Tee {
  struct __pyx_vtabstruct_6osmium_7handler_Base __pyx_base;
};
static struct __pyx_vtabstruct_6osmium_7handler_Tee *__pyx_vtabptr_6osmium_7handler_Tee;

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif

#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact); /*proto*/

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/

#ifndef __Pyx_CppExn2PyErr
static void __Pyx_CppExn2PyErr() {
  // Catch a handful of different errors here and turn them into the
  // equivalent Python errors.
  try {
    if (PyErr_Occurred())
      ; // let the latest Python exn pass through and ignore the current one
    else
      throw;
  } catch (const std::bad_alloc& exn) {
    PyErr_SetString(PyExc_MemoryError, exn.what());
  } catch (const std::bad_cast& exn) {
    PyErr_SetString(PyExc_TypeError, exn.what());
  } catch (const std::domain_error& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::invalid_argument& exn) {
    PyErr_SetString(PyExc_ValueError, exn.what());
  } catch (const std::ios_base::failure& exn) {
    // Unfortunately, in standard C++ we have no way of distinguishing EOF
    // from other errors here; be careful with the exception mask
    PyErr_SetString(PyExc_IOError, exn.what());
  } catch (const std::out_of_range& exn) {
    // Change out_of_range to IndexError
    PyErr_SetString(PyExc_IndexError, exn.what());
  } catch (const std::overflow_error& exn) {
    PyErr_SetString(PyExc_OverflowError, exn.what());
  } catch (const std::range_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::underflow_error& exn) {
    PyErr_SetString(PyExc_ArithmeticError, exn.what());
  } catch (const std::exception& exn) {
    PyErr_SetString(PyExc_RuntimeError, exn.what());
  }
  catch (...)
  {
    PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  }
}
#endif

static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
#if PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_osm_object_id_t(osm_object_id_t);

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static int __Pyx_check_binary_version(void);

static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);  /*proto*/

static PyObject *__Pyx_ImportModule(const char *name); /*proto*/

static void* __Pyx_GetVtable(PyObject *dict); /*proto*/

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); /*proto*/

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/

/* Module declarations from 'libcpp.string' */

/* Module declarations from 'libcpp' */

/* Module declarations from 'c_osmium' */

/* Module declarations from 'libc.stdint' */

/* Module declarations from 'c_osmium.osm' */

/* Module declarations from 'c_osmium.handler' */

/* Module declarations from 'c_osmium.output' */

/* Module declarations from 'c_osmium.osmfile' */

/* Module declarations from 'osmium.osm' */
static PyTypeObject *__pyx_ptype_6osmium_3osm_TagList = 0;
static PyTypeObject *__pyx_ptype_6osmium_3osm_WayNodeList = 0;
static PyTypeObject *__pyx_ptype_6osmium_3osm_RelationMemberList = 0;
static PyTypeObject *__pyx_ptype_6osmium_3osm_Object = 0;
static PyTypeObject *__pyx_ptype_6osmium_3osm_Node = 0;
static PyTypeObject *__pyx_ptype_6osmium_3osm_Way = 0;
static PyTypeObject *__pyx_ptype_6osmium_3osm_Relation = 0;
static PyTypeObject *__pyx_ptype_6osmium_3osm_Bounds = 0;
static PyTypeObject *__pyx_ptype_6osmium_3osm_Meta = 0;
static struct __pyx_obj_6osmium_3osm_Node **__pyx_vp_6osmium_3osm__cache_node = 0;
#define __pyx_v_6osmium_3osm__cache_node (*__pyx_vp_6osmium_3osm__cache_node)
static struct __pyx_obj_6osmium_3osm_Way **__pyx_vp_6osmium_3osm__cache_way = 0;
#define __pyx_v_6osmium_3osm__cache_way (*__pyx_vp_6osmium_3osm__cache_way)
static struct __pyx_obj_6osmium_3osm_Relation **__pyx_vp_6osmium_3osm__cache_relation = 0;
#define __pyx_v_6osmium_3osm__cache_relation (*__pyx_vp_6osmium_3osm__cache_relation)
static struct __pyx_obj_6osmium_3osm_TagList **__pyx_vp_6osmium_3osm__cache_taglist = 0;
#define __pyx_v_6osmium_3osm__cache_taglist (*__pyx_vp_6osmium_3osm__cache_taglist)
static struct __pyx_obj_6osmium_3osm_WayNodeList **__pyx_vp_6osmium_3osm__cache_waynodelist = 0;
#define __pyx_v_6osmium_3osm__cache_waynodelist (*__pyx_vp_6osmium_3osm__cache_waynodelist)
static struct __pyx_obj_6osmium_3osm_RelationMemberList **__pyx_vp_6osmium_3osm__cache_relationmemberlist = 0;
#define __pyx_v_6osmium_3osm__cache_relationmemberlist (*__pyx_vp_6osmium_3osm__cache_relationmemberlist)

/* Module declarations from '__builtin__' */

/* Module declarations from 'osmium.handler' */
static PyTypeObject *__pyx_ptype_6osmium_7handler_Exception = 0;
static PyTypeObject *__pyx_ptype_6osmium_7handler_StopReading = 0;
static PyTypeObject *__pyx_ptype_6osmium_7handler_Base = 0;
static PyTypeObject *__pyx_ptype_6osmium_7handler_Debug = 0;
static PyTypeObject *__pyx_ptype_6osmium_7handler_Progress = 0;
static PyTypeObject *__pyx_ptype_6osmium_7handler_Tee = 0;
static PyTypeObject *__pyx_ptype_6osmium_7handler_Forward = 0;

/* Module declarations from 'osmium.examples' */
static PyTypeObject *__pyx_ptype_6osmium_8examples_ExampleHandler = 0;
#define __Pyx_MODULE_NAME "osmium.examples"
int __pyx_module_is_main_osmium__examples = 0;

/* Implementation of 'osmium.examples' */
static char __pyx_k_1[] = "INIT:";
static char __pyx_k_2[] = "BEFORE NODES";
static char __pyx_k_3[] = "NODE:";
static char __pyx_k_4[] = "object-id: ";
static char __pyx_k_5[] = "address: ";
static char __pyx_k_6[] = "AFTER NODES";
static char __pyx_k_7[] = "BEFORE WAYS";
static char __pyx_k_8[] = "WAY:";
static char __pyx_k_9[] = "object-id:";
static char __pyx_k_10[] = "address:";
static char __pyx_k_11[] = "AFTER WAYS";
static char __pyx_k_12[] = "BEFORE RELATIONS";
static char __pyx_k_13[] = "RELATION:";
static char __pyx_k_14[] = "AFTER RELATIONS";
static char __pyx_k_15[] = "osmium.handler";
static char __pyx_k_16[] = "osmium.examples";
static char __pyx_k__way[] = "way";
static char __pyx_k__Base[] = "Base";
static char __pyx_k__init[] = "init";
static char __pyx_k__node[] = "node";
static char __pyx_k__tags[] = "tags";
static char __pyx_k__Debug[] = "Debug";
static char __pyx_k__FINAL[] = "FINAL";
static char __pyx_k__final[] = "final";
static char __pyx_k__nodes[] = "nodes";
static char __pyx_k__members[] = "members";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__relation[] = "relation";
static char __pyx_k__read_file[] = "read_file";
static char __pyx_k__after_ways[] = "after_ways";
static char __pyx_k__debug_read[] = "debug_read";
static char __pyx_k__after_nodes[] = "after_nodes";
static char __pyx_k__before_ways[] = "before_ways";
static char __pyx_k__before_nodes[] = "before_nodes";
static char __pyx_k__after_relations[] = "after_relations";
static char __pyx_k__before_relations[] = "before_relations";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_kp_s_10;
static PyObject *__pyx_kp_s_11;
static PyObject *__pyx_kp_s_12;
static PyObject *__pyx_kp_s_13;
static PyObject *__pyx_kp_s_14;
static PyObject *__pyx_n_s_15;
static PyObject *__pyx_n_s_16;
static PyObject *__pyx_kp_s_2;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_kp_s_6;
static PyObject *__pyx_kp_s_7;
static PyObject *__pyx_kp_s_8;
static PyObject *__pyx_kp_s_9;
static PyObject *__pyx_n_s__Base;
static PyObject *__pyx_n_s__Debug;
static PyObject *__pyx_n_s__FINAL;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__after_nodes;
static PyObject *__pyx_n_s__after_relations;
static PyObject *__pyx_n_s__after_ways;
static PyObject *__pyx_n_s__before_nodes;
static PyObject *__pyx_n_s__before_relations;
static PyObject *__pyx_n_s__before_ways;
static PyObject *__pyx_n_s__debug_read;
static PyObject *__pyx_n_s__final;
static PyObject *__pyx_n_s__init;
static PyObject *__pyx_n_s__members;
static PyObject *__pyx_n_s__node;
static PyObject *__pyx_n_s__nodes;
static PyObject *__pyx_n_s__read_file;
static PyObject *__pyx_n_s__relation;
static PyObject *__pyx_n_s__tags;
static PyObject *__pyx_n_s__way;

/* "osmium/examples.pyx":10
 * from osmium.handler cimport Meta, Node, Way, Relation
 * 
 * def read_file(name):             # <<<<<<<<<<<<<<
 *     c_osmium.init(True)
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_read_file(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static PyMethodDef __pyx_mdef_6osmium_8examples_read_file = {__Pyx_NAMESTR("read_file"), (PyCFunction)__pyx_pf_6osmium_8examples_read_file, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_6osmium_8examples_read_file(PyObject *__pyx_self, PyObject *__pyx_v_name) {
  char *__pyx_v_namecstr;
  std::string __pyx_v_namestr;
  Osmium::OSMFile *__pyx_v_infile;
  struct osmhandler_struct *__pyx_v_python_handler = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  Osmium::OSMFile *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("read_file");
  __pyx_self = __pyx_self;

  /* "osmium/examples.pyx":11
 * 
 * def read_file(name):
 *     c_osmium.init(True)             # <<<<<<<<<<<<<<
 * 
 *     cdef char * namecstr = name
 */
  Osmium::init(1);

  /* "osmium/examples.pyx":13
 *     c_osmium.init(True)
 * 
 *     cdef char * namecstr = name             # <<<<<<<<<<<<<<
 *     cdef string namestr
 *     namestr.assign(namecstr)
 */
  __pyx_t_1 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_namecstr = __pyx_t_1;

  /* "osmium/examples.pyx":15
 *     cdef char * namecstr = name
 *     cdef string namestr
 *     namestr.assign(namecstr)             # <<<<<<<<<<<<<<
 *     cdef c_OSMFile *infile = new c_OSMFile(namestr)
 *     cdef osmhandler python_handler = osmhandler()
 */
  __pyx_v_namestr.assign(__pyx_v_namecstr);

  /* "osmium/examples.pyx":16
 *     cdef string namestr
 *     namestr.assign(namecstr)
 *     cdef c_OSMFile *infile = new c_OSMFile(namestr)             # <<<<<<<<<<<<<<
 *     cdef osmhandler python_handler = osmhandler()
 * 
 */
  try {__pyx_t_2 = new Osmium::OSMFile(__pyx_v_namestr);} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
  __pyx_v_infile = __pyx_t_2;

  /* "osmium/examples.pyx":17
 *     namestr.assign(namecstr)
 *     cdef c_OSMFile *infile = new c_OSMFile(namestr)
 *     cdef osmhandler python_handler = osmhandler()             # <<<<<<<<<<<<<<
 * 
 *     python_handler.handle_infile(infile)
 */
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6osmium_7handler_Base)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_python_handler = ((struct osmhandler_struct *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "osmium/examples.pyx":19
 *     cdef osmhandler python_handler = osmhandler()
 * 
 *     python_handler.handle_infile(infile)             # <<<<<<<<<<<<<<
 * 
 * def debug_read(name):
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_6osmium_7handler_Base *)__pyx_v_python_handler->__pyx_vtab)->handle_infile(__pyx_v_python_handler, __pyx_v_infile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("osmium.examples.read_file", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_python_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":21
 *     python_handler.handle_infile(infile)
 * 
 * def debug_read(name):             # <<<<<<<<<<<<<<
 *     c_osmium.init(True)
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_1debug_read(PyObject *__pyx_self, PyObject *__pyx_v_name); /*proto*/
static PyMethodDef __pyx_mdef_6osmium_8examples_1debug_read = {__Pyx_NAMESTR("debug_read"), (PyCFunction)__pyx_pf_6osmium_8examples_1debug_read, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pf_6osmium_8examples_1debug_read(PyObject *__pyx_self, PyObject *__pyx_v_name) {
  char *__pyx_v_namecstr;
  std::string __pyx_v_namestr;
  Osmium::OSMFile *__pyx_v_infile;
  struct osmhandler_struct *__pyx_v_python_handler = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char *__pyx_t_1;
  Osmium::OSMFile *__pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("debug_read");
  __pyx_self = __pyx_self;

  /* "osmium/examples.pyx":22
 * 
 * def debug_read(name):
 *     c_osmium.init(True)             # <<<<<<<<<<<<<<
 * 
 *     cdef char * namecstr = name
 */
  Osmium::init(1);

  /* "osmium/examples.pyx":24
 *     c_osmium.init(True)
 * 
 *     cdef char * namecstr = name             # <<<<<<<<<<<<<<
 *     cdef string namestr
 *     namestr.assign(namecstr)
 */
  __pyx_t_1 = PyBytes_AsString(__pyx_v_name); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_namecstr = __pyx_t_1;

  /* "osmium/examples.pyx":26
 *     cdef char * namecstr = name
 *     cdef string namestr
 *     namestr.assign(namecstr)             # <<<<<<<<<<<<<<
 *     cdef c_OSMFile *infile = new c_OSMFile(namestr)
 * 
 */
  __pyx_v_namestr.assign(__pyx_v_namecstr);

  /* "osmium/examples.pyx":27
 *     cdef string namestr
 *     namestr.assign(namecstr)
 *     cdef c_OSMFile *infile = new c_OSMFile(namestr)             # <<<<<<<<<<<<<<
 * 
 *     cdef osmhandler python_handler = debug_handler()
 */
  try {__pyx_t_2 = new Osmium::OSMFile(__pyx_v_namestr);} catch(...) {__Pyx_CppExn2PyErr(); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}}
  __pyx_v_infile = __pyx_t_2;

  /* "osmium/examples.pyx":29
 *     cdef c_OSMFile *infile = new c_OSMFile(namestr)
 * 
 *     cdef osmhandler python_handler = debug_handler()             # <<<<<<<<<<<<<<
 * 
 *     python_handler.handle_infile(infile)
 */
  __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6osmium_7handler_Debug)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_python_handler = ((struct osmhandler_struct *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "osmium/examples.pyx":31
 *     cdef osmhandler python_handler = debug_handler()
 * 
 *     python_handler.handle_infile(infile)             # <<<<<<<<<<<<<<
 * 
 * cdef class ExampleHandler(osmhandler):
 */
  __pyx_t_3 = ((struct __pyx_vtabstruct_6osmium_7handler_Base *)__pyx_v_python_handler->__pyx_vtab)->handle_infile(__pyx_v_python_handler, __pyx_v_infile); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("osmium.examples.debug_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_python_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":38
 *     cdef public Relation saved_relation
 * 
 *     cpdef init(self, Meta curmeta):             # <<<<<<<<<<<<<<
 *         print("INIT:")
 *         print(curmeta)
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_init(PyObject *__pyx_v_self, PyObject *__pyx_v_curmeta); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_init(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, struct __pyx_obj_6osmium_3osm_Meta *__pyx_v_curmeta, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_init)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_curmeta));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_curmeta));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_curmeta));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":39
 * 
 *     cpdef init(self, Meta curmeta):
 *         print("INIT:")             # <<<<<<<<<<<<<<
 *         print(curmeta)
 * 
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "osmium/examples.pyx":40
 *     cpdef init(self, Meta curmeta):
 *         print("INIT:")
 *         print(curmeta)             # <<<<<<<<<<<<<<
 * 
 *     cpdef before_nodes(self):
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_v_curmeta)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":38
 *     cdef public Relation saved_relation
 * 
 *     cpdef init(self, Meta curmeta):             # <<<<<<<<<<<<<<
 *         print("INIT:")
 *         print(curmeta)
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_init(PyObject *__pyx_v_self, PyObject *__pyx_v_curmeta); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_init(PyObject *__pyx_v_self, PyObject *__pyx_v_curmeta) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("init");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curmeta), __pyx_ptype_6osmium_3osm_Meta, 1, "curmeta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.init(((struct osmhandler_struct *)__pyx_v_self), ((struct __pyx_obj_6osmium_3osm_Meta *)__pyx_v_curmeta), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.init", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":42
 *         print(curmeta)
 * 
 *     cpdef before_nodes(self):             # <<<<<<<<<<<<<<
 *         print("BEFORE NODES")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_1before_nodes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_before_nodes(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("before_nodes");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__before_nodes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_1before_nodes)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":43
 * 
 *     cpdef before_nodes(self):
 *         print("BEFORE NODES")             # <<<<<<<<<<<<<<
 * 
 *     cpdef node(self, Node curnode):
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.before_nodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":42
 *         print(curmeta)
 * 
 *     cpdef before_nodes(self):             # <<<<<<<<<<<<<<
 *         print("BEFORE NODES")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_1before_nodes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_1before_nodes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("before_nodes");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.before_nodes(((struct osmhandler_struct *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.before_nodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":45
 *         print("BEFORE NODES")
 * 
 *     cpdef node(self, Node curnode):             # <<<<<<<<<<<<<<
 *         """node_callback(self, curnode)
 *         default handler for nodes
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_2node(PyObject *__pyx_v_self, PyObject *__pyx_v_curnode); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_node(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, struct __pyx_obj_6osmium_3osm_Node *__pyx_v_curnode, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("node");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__node); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_2node)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_curnode));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_curnode));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_curnode));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":49
 *         default handler for nodes
 *         """
 *         print("NODE:")             # <<<<<<<<<<<<<<
 *         print("object-id: ", curnode.c_object[0].get().o_id())
 *         print("address: ", <long>curnode.c_object[0].get())
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "osmium/examples.pyx":50
 *         """
 *         print("NODE:")
 *         print("object-id: ", curnode.c_object[0].get().o_id())             # <<<<<<<<<<<<<<
 *         print("address: ", <long>curnode.c_object[0].get())
 *         if curnode.tags:
 */
  __pyx_t_1 = __Pyx_PyInt_to_py_osm_object_id_t((__pyx_v_curnode->__pyx_base.c_object[0]).get()->id()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_4));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_4));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "osmium/examples.pyx":51
 *         print("NODE:")
 *         print("object-id: ", curnode.c_object[0].get().o_id())
 *         print("address: ", <long>curnode.c_object[0].get())             # <<<<<<<<<<<<<<
 *         if curnode.tags:
 *             self.saved_node = curnode
 */
  __pyx_t_3 = PyInt_FromLong(((long)(__pyx_v_curnode->__pyx_base.c_object[0]).get())); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_5));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_5));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "osmium/examples.pyx":52
 *         print("object-id: ", curnode.c_object[0].get().o_id())
 *         print("address: ", <long>curnode.c_object[0].get())
 *         if curnode.tags:             # <<<<<<<<<<<<<<
 *             self.saved_node = curnode
 *         print(curnode.tags)
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_curnode), __pyx_n_s__tags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_4) {

    /* "osmium/examples.pyx":53
 *         print("address: ", <long>curnode.c_object[0].get())
 *         if curnode.tags:
 *             self.saved_node = curnode             # <<<<<<<<<<<<<<
 *         print(curnode.tags)
 * 
 */
    __Pyx_INCREF(((PyObject *)__pyx_v_curnode));
    __Pyx_GIVEREF(((PyObject *)__pyx_v_curnode));
    __Pyx_GOTREF(__pyx_v_self->saved_node);
    __Pyx_DECREF(((PyObject *)__pyx_v_self->saved_node));
    __pyx_v_self->saved_node = __pyx_v_curnode;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "osmium/examples.pyx":54
 *         if curnode.tags:
 *             self.saved_node = curnode
 *         print(curnode.tags)             # <<<<<<<<<<<<<<
 * 
 *     cpdef after_nodes(self):
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_curnode), __pyx_n_s__tags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PrintOne(0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":45
 *         print("BEFORE NODES")
 * 
 *     cpdef node(self, Node curnode):             # <<<<<<<<<<<<<<
 *         """node_callback(self, curnode)
 *         default handler for nodes
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_2node(PyObject *__pyx_v_self, PyObject *__pyx_v_curnode); /*proto*/
static char __pyx_doc_6osmium_8examples_14ExampleHandler_2node[] = "node_callback(self, curnode)\n        default handler for nodes\n        ";
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_2node(PyObject *__pyx_v_self, PyObject *__pyx_v_curnode) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("node");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curnode), __pyx_ptype_6osmium_3osm_Node, 1, "curnode", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.node(((struct osmhandler_struct *)__pyx_v_self), ((struct __pyx_obj_6osmium_3osm_Node *)__pyx_v_curnode), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.node", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":56
 *         print(curnode.tags)
 * 
 *     cpdef after_nodes(self):             # <<<<<<<<<<<<<<
 *         print("AFTER NODES")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_3after_nodes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_after_nodes(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("after_nodes");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__after_nodes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_3after_nodes)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":57
 * 
 *     cpdef after_nodes(self):
 *         print("AFTER NODES")             # <<<<<<<<<<<<<<
 * 
 *     cpdef before_ways(self):
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.after_nodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":56
 *         print(curnode.tags)
 * 
 *     cpdef after_nodes(self):             # <<<<<<<<<<<<<<
 *         print("AFTER NODES")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_3after_nodes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_3after_nodes(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("after_nodes");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.after_nodes(((struct osmhandler_struct *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.after_nodes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":59
 *         print("AFTER NODES")
 * 
 *     cpdef before_ways(self):             # <<<<<<<<<<<<<<
 *         print("BEFORE WAYS")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_4before_ways(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_before_ways(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("before_ways");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__before_ways); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_4before_ways)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":60
 * 
 *     cpdef before_ways(self):
 *         print("BEFORE WAYS")             # <<<<<<<<<<<<<<
 * 
 *     cpdef way(self, Way curway):
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_7)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.before_ways", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":59
 *         print("AFTER NODES")
 * 
 *     cpdef before_ways(self):             # <<<<<<<<<<<<<<
 *         print("BEFORE WAYS")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_4before_ways(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_4before_ways(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("before_ways");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.before_ways(((struct osmhandler_struct *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.before_ways", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":62
 *         print("BEFORE WAYS")
 * 
 *     cpdef way(self, Way curway):             # <<<<<<<<<<<<<<
 *         print("WAY:")
 *         print("object-id:", curway.c_object[0].get().o_id())
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_5way(PyObject *__pyx_v_self, PyObject *__pyx_v_curway); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_way(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, struct __pyx_obj_6osmium_3osm_Way *__pyx_v_curway, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("way");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__way); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_5way)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_curway));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_curway));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_curway));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":63
 * 
 *     cpdef way(self, Way curway):
 *         print("WAY:")             # <<<<<<<<<<<<<<
 *         print("object-id:", curway.c_object[0].get().o_id())
 *         print("address:",   <long>curway.c_object[0].get())
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "osmium/examples.pyx":64
 *     cpdef way(self, Way curway):
 *         print("WAY:")
 *         print("object-id:", curway.c_object[0].get().o_id())             # <<<<<<<<<<<<<<
 *         print("address:",   <long>curway.c_object[0].get())
 *         print(curway.tags)
 */
  __pyx_t_1 = __Pyx_PyInt_to_py_osm_object_id_t((__pyx_v_curway->__pyx_base.c_object[0]).get()->id()); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_9));
  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_9));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9));
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;

  /* "osmium/examples.pyx":65
 *         print("WAY:")
 *         print("object-id:", curway.c_object[0].get().o_id())
 *         print("address:",   <long>curway.c_object[0].get())             # <<<<<<<<<<<<<<
 *         print(curway.tags)
 *         print(curway.nodes)
 */
  __pyx_t_3 = PyInt_FromLong(((long)(__pyx_v_curway->__pyx_base.c_object[0]).get())); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_10));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_10));
  __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10));
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;

  /* "osmium/examples.pyx":66
 *         print("object-id:", curway.c_object[0].get().o_id())
 *         print("address:",   <long>curway.c_object[0].get())
 *         print(curway.tags)             # <<<<<<<<<<<<<<
 *         print(curway.nodes)
 *         self.saved_way = curway
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_curway), __pyx_n_s__tags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PrintOne(0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "osmium/examples.pyx":67
 *         print("address:",   <long>curway.c_object[0].get())
 *         print(curway.tags)
 *         print(curway.nodes)             # <<<<<<<<<<<<<<
 *         self.saved_way = curway
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_curway), __pyx_n_s__nodes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PrintOne(0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "osmium/examples.pyx":68
 *         print(curway.tags)
 *         print(curway.nodes)
 *         self.saved_way = curway             # <<<<<<<<<<<<<<
 * 
 *     cpdef after_ways(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_curway));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_curway));
  __Pyx_GOTREF(__pyx_v_self->saved_way);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->saved_way));
  __pyx_v_self->saved_way = __pyx_v_curway;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.way", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":62
 *         print("BEFORE WAYS")
 * 
 *     cpdef way(self, Way curway):             # <<<<<<<<<<<<<<
 *         print("WAY:")
 *         print("object-id:", curway.c_object[0].get().o_id())
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_5way(PyObject *__pyx_v_self, PyObject *__pyx_v_curway); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_5way(PyObject *__pyx_v_self, PyObject *__pyx_v_curway) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("way");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_curway), __pyx_ptype_6osmium_3osm_Way, 1, "curway", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.way(((struct osmhandler_struct *)__pyx_v_self), ((struct __pyx_obj_6osmium_3osm_Way *)__pyx_v_curway), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.way", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":70
 *         self.saved_way = curway
 * 
 *     cpdef after_ways(self):             # <<<<<<<<<<<<<<
 *         print("AFTER WAYS")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_6after_ways(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_after_ways(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("after_ways");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__after_ways); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_6after_ways)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":71
 * 
 *     cpdef after_ways(self):
 *         print("AFTER WAYS")             # <<<<<<<<<<<<<<
 * 
 *     cpdef before_relations(self):
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_11)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.after_ways", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":70
 *         self.saved_way = curway
 * 
 *     cpdef after_ways(self):             # <<<<<<<<<<<<<<
 *         print("AFTER WAYS")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_6after_ways(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_6after_ways(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("after_ways");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.after_ways(((struct osmhandler_struct *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.after_ways", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":73
 *         print("AFTER WAYS")
 * 
 *     cpdef before_relations(self):             # <<<<<<<<<<<<<<
 *         print("BEFORE RELATIONS")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_7before_relations(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_before_relations(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("before_relations");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__before_relations); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_7before_relations)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":74
 * 
 *     cpdef before_relations(self):
 *         print("BEFORE RELATIONS")             # <<<<<<<<<<<<<<
 * 
 *     cpdef relation(self, Relation currel):
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_12)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.before_relations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":73
 *         print("AFTER WAYS")
 * 
 *     cpdef before_relations(self):             # <<<<<<<<<<<<<<
 *         print("BEFORE RELATIONS")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_7before_relations(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_7before_relations(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("before_relations");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.before_relations(((struct osmhandler_struct *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.before_relations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":76
 *         print("BEFORE RELATIONS")
 * 
 *     cpdef relation(self, Relation currel):             # <<<<<<<<<<<<<<
 *         print("RELATION:")
 *         print(currel.tags)
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_8relation(PyObject *__pyx_v_self, PyObject *__pyx_v_currel); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_relation(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, struct __pyx_obj_6osmium_3osm_Relation *__pyx_v_currel, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("relation");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__relation); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_8relation)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_INCREF(((PyObject *)__pyx_v_currel));
      PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_currel));
      __Pyx_GIVEREF(((PyObject *)__pyx_v_currel));
      __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      __pyx_r = __pyx_t_3;
      __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":77
 * 
 *     cpdef relation(self, Relation currel):
 *         print("RELATION:")             # <<<<<<<<<<<<<<
 *         print(currel.tags)
 *         print(currel.members)
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_13)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "osmium/examples.pyx":78
 *     cpdef relation(self, Relation currel):
 *         print("RELATION:")
 *         print(currel.tags)             # <<<<<<<<<<<<<<
 *         print(currel.members)
 *         self.saved_relation = currel
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_currel), __pyx_n_s__tags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PrintOne(0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "osmium/examples.pyx":79
 *         print("RELATION:")
 *         print(currel.tags)
 *         print(currel.members)             # <<<<<<<<<<<<<<
 *         self.saved_relation = currel
 * 
 */
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_currel), __pyx_n_s__members); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PrintOne(0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "osmium/examples.pyx":80
 *         print(currel.tags)
 *         print(currel.members)
 *         self.saved_relation = currel             # <<<<<<<<<<<<<<
 * 
 *     cpdef after_relations(self):
 */
  __Pyx_INCREF(((PyObject *)__pyx_v_currel));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_currel));
  __Pyx_GOTREF(__pyx_v_self->saved_relation);
  __Pyx_DECREF(((PyObject *)__pyx_v_self->saved_relation));
  __pyx_v_self->saved_relation = __pyx_v_currel;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.relation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":76
 *         print("BEFORE RELATIONS")
 * 
 *     cpdef relation(self, Relation currel):             # <<<<<<<<<<<<<<
 *         print("RELATION:")
 *         print(currel.tags)
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_8relation(PyObject *__pyx_v_self, PyObject *__pyx_v_currel); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_8relation(PyObject *__pyx_v_self, PyObject *__pyx_v_currel) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("relation");
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_currel), __pyx_ptype_6osmium_3osm_Relation, 1, "currel", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.relation(((struct osmhandler_struct *)__pyx_v_self), ((struct __pyx_obj_6osmium_3osm_Relation *)__pyx_v_currel), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.relation", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":82
 *         self.saved_relation = currel
 * 
 *     cpdef after_relations(self):             # <<<<<<<<<<<<<<
 *         print("AFTER RELATIONS")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_9after_relations(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_after_relations(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("after_relations");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__after_relations); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_9after_relations)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":83
 * 
 *     cpdef after_relations(self):
 *         print("AFTER RELATIONS")             # <<<<<<<<<<<<<<
 * 
 *     cpdef final(self):
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.after_relations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":82
 *         self.saved_relation = currel
 * 
 *     cpdef after_relations(self):             # <<<<<<<<<<<<<<
 *         print("AFTER RELATIONS")
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_9after_relations(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_9after_relations(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("after_relations");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.after_relations(((struct osmhandler_struct *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.after_relations", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":85
 *         print("AFTER RELATIONS")
 * 
 *     cpdef final(self):             # <<<<<<<<<<<<<<
 *         print("FINAL")
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_10final(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_f_6osmium_8examples_14ExampleHandler_final(struct __pyx_obj_6osmium_8examples_ExampleHandler *__pyx_v_self, int __pyx_skip_dispatch) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("final");
  /* Check if called by wrapper */
  if (unlikely(__pyx_skip_dispatch)) ;
  /* Check if overriden in Python */
  else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) {
    __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__final); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_6osmium_8examples_14ExampleHandler_10final)) {
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L0;
    }
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "osmium/examples.pyx":86
 * 
 *     cpdef final(self):
 *         print("FINAL")             # <<<<<<<<<<<<<<
 */
  if (__Pyx_PrintOne(0, ((PyObject *)__pyx_n_s__FINAL)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.final", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":85
 *         print("AFTER RELATIONS")
 * 
 *     cpdef final(self):             # <<<<<<<<<<<<<<
 *         print("FINAL")
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_10final(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_10final(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("final");
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.final(((struct osmhandler_struct *)__pyx_v_self), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.final", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":34
 * 
 * cdef class ExampleHandler(osmhandler):
 *     cdef public Node saved_node             # <<<<<<<<<<<<<<
 *     cdef public Way saved_way
 *     cdef public Relation saved_relation
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_10saved_node___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_10saved_node___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_node));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_node);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6osmium_8examples_14ExampleHandler_10saved_node_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_6osmium_8examples_14ExampleHandler_10saved_node_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6osmium_3osm_Node))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_node);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_node));
  ((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_node = ((struct __pyx_obj_6osmium_3osm_Node *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.saved_node.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6osmium_8examples_14ExampleHandler_10saved_node_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_6osmium_8examples_14ExampleHandler_10saved_node_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_node);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_node));
  ((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_node = ((struct __pyx_obj_6osmium_3osm_Node *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":35
 * cdef class ExampleHandler(osmhandler):
 *     cdef public Node saved_node
 *     cdef public Way saved_way             # <<<<<<<<<<<<<<
 *     cdef public Relation saved_relation
 * 
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_9saved_way___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_9saved_way___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_way));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_way);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6osmium_8examples_14ExampleHandler_9saved_way_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_6osmium_8examples_14ExampleHandler_9saved_way_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6osmium_3osm_Way))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_way);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_way));
  ((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_way = ((struct __pyx_obj_6osmium_3osm_Way *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.saved_way.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6osmium_8examples_14ExampleHandler_9saved_way_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_6osmium_8examples_14ExampleHandler_9saved_way_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_way);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_way));
  ((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_way = ((struct __pyx_obj_6osmium_3osm_Way *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "osmium/examples.pyx":36
 *     cdef public Node saved_node
 *     cdef public Way saved_way
 *     cdef public Relation saved_relation             # <<<<<<<<<<<<<<
 * 
 *     cpdef init(self, Meta curmeta):
 */

static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_14saved_relation___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pf_6osmium_8examples_14ExampleHandler_14saved_relation___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__");
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_relation));
  __pyx_r = ((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_relation);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6osmium_8examples_14ExampleHandler_14saved_relation_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pf_6osmium_8examples_14ExampleHandler_14saved_relation_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__");
  if (!(likely(((__pyx_v_value) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_value, __pyx_ptype_6osmium_3osm_Relation))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_INCREF(__pyx_v_value);
  __Pyx_GIVEREF(__pyx_v_value);
  __Pyx_GOTREF(((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_relation);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_relation));
  ((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_relation = ((struct __pyx_obj_6osmium_3osm_Relation *)__pyx_v_value);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("osmium.examples.ExampleHandler.saved_relation.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_6osmium_8examples_14ExampleHandler_14saved_relation_2__del__(PyObject *__pyx_v_self); /*proto*/
static int __pyx_pf_6osmium_8examples_14ExampleHandler_14saved_relation_2__del__(PyObject *__pyx_v_self) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__del__");
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_relation);
  __Pyx_DECREF(((PyObject *)((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_relation));
  ((struct __pyx_obj_6osmium_8examples_ExampleHandler *)__pyx_v_self)->saved_relation = ((struct __pyx_obj_6osmium_3osm_Relation *)Py_None);

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static struct __pyx_vtabstruct_6osmium_8examples_ExampleHandler __pyx_vtable_6osmium_8examples_ExampleHandler;

static PyObject *__pyx_tp_new_6osmium_8examples_ExampleHandler(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6osmium_8examples_ExampleHandler *p;
  PyObject *o = __pyx_ptype_6osmium_7handler_Base->tp_new(t, a, k);
  if (!o) return 0;
  p = ((struct __pyx_obj_6osmium_8examples_ExampleHandler *)o);
  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6osmium_7handler_Base*)__pyx_vtabptr_6osmium_8examples_ExampleHandler;
  p->saved_node = ((struct __pyx_obj_6osmium_3osm_Node *)Py_None); Py_INCREF(Py_None);
  p->saved_way = ((struct __pyx_obj_6osmium_3osm_Way *)Py_None); Py_INCREF(Py_None);
  p->saved_relation = ((struct __pyx_obj_6osmium_3osm_Relation *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6osmium_8examples_ExampleHandler(PyObject *o) {
  struct __pyx_obj_6osmium_8examples_ExampleHandler *p = (struct __pyx_obj_6osmium_8examples_ExampleHandler *)o;
  Py_XDECREF(((PyObject *)p->saved_node));
  Py_XDECREF(((PyObject *)p->saved_way));
  Py_XDECREF(((PyObject *)p->saved_relation));
  __pyx_ptype_6osmium_7handler_Base->tp_dealloc(o);
}

static int __pyx_tp_traverse_6osmium_8examples_ExampleHandler(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6osmium_8examples_ExampleHandler *p = (struct __pyx_obj_6osmium_8examples_ExampleHandler *)o;
  if (__pyx_ptype_6osmium_7handler_Base->tp_traverse) {
    e = __pyx_ptype_6osmium_7handler_Base->tp_traverse(o, v, a); if (e) return e;
  }
  if (p->saved_node) {
    e = (*v)(((PyObject*)p->saved_node), a); if (e) return e;
  }
  if (p->saved_way) {
    e = (*v)(((PyObject*)p->saved_way), a); if (e) return e;
  }
  if (p->saved_relation) {
    e = (*v)(((PyObject*)p->saved_relation), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6osmium_8examples_ExampleHandler(PyObject *o) {
  struct __pyx_obj_6osmium_8examples_ExampleHandler *p = (struct __pyx_obj_6osmium_8examples_ExampleHandler *)o;
  PyObject* tmp;
  if (__pyx_ptype_6osmium_7handler_Base->tp_clear) {
    __pyx_ptype_6osmium_7handler_Base->tp_clear(o);
  }
  tmp = ((PyObject*)p->saved_node);
  p->saved_node = ((struct __pyx_obj_6osmium_3osm_Node *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->saved_way);
  p->saved_way = ((struct __pyx_obj_6osmium_3osm_Way *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->saved_relation);
  p->saved_relation = ((struct __pyx_obj_6osmium_3osm_Relation *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyObject *__pyx_getprop_6osmium_8examples_14ExampleHandler_saved_node(PyObject *o, void *x) {
  return __pyx_pf_6osmium_8examples_14ExampleHandler_10saved_node___get__(o);
}

static int __pyx_setprop_6osmium_8examples_14ExampleHandler_saved_node(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_6osmium_8examples_14ExampleHandler_10saved_node_1__set__(o, v);
  }
  else {
    return __pyx_pf_6osmium_8examples_14ExampleHandler_10saved_node_2__del__(o);
  }
}

static PyObject *__pyx_getprop_6osmium_8examples_14ExampleHandler_saved_way(PyObject *o, void *x) {
  return __pyx_pf_6osmium_8examples_14ExampleHandler_9saved_way___get__(o);
}

static int __pyx_setprop_6osmium_8examples_14ExampleHandler_saved_way(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_6osmium_8examples_14ExampleHandler_9saved_way_1__set__(o, v);
  }
  else {
    return __pyx_pf_6osmium_8examples_14ExampleHandler_9saved_way_2__del__(o);
  }
}

static PyObject *__pyx_getprop_6osmium_8examples_14ExampleHandler_saved_relation(PyObject *o, void *x) {
  return __pyx_pf_6osmium_8examples_14ExampleHandler_14saved_relation___get__(o);
}

static int __pyx_setprop_6osmium_8examples_14ExampleHandler_saved_relation(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pf_6osmium_8examples_14ExampleHandler_14saved_relation_1__set__(o, v);
  }
  else {
    return __pyx_pf_6osmium_8examples_14ExampleHandler_14saved_relation_2__del__(o);
  }
}

static PyMethodDef __pyx_methods_6osmium_8examples_ExampleHandler[] = {
  {__Pyx_NAMESTR("init"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_init, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("before_nodes"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_1before_nodes, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("node"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_2node, METH_O, __Pyx_DOCSTR(__pyx_doc_6osmium_8examples_14ExampleHandler_2node)},
  {__Pyx_NAMESTR("after_nodes"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_3after_nodes, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("before_ways"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_4before_ways, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("way"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_5way, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("after_ways"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_6after_ways, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("before_relations"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_7before_relations, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("relation"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_8relation, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("after_relations"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_9after_relations, METH_NOARGS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("final"), (PyCFunction)__pyx_pf_6osmium_8examples_14ExampleHandler_10final, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6osmium_8examples_ExampleHandler[] = {
  {(char *)"saved_node", __pyx_getprop_6osmium_8examples_14ExampleHandler_saved_node, __pyx_setprop_6osmium_8examples_14ExampleHandler_saved_node, 0, 0},
  {(char *)"saved_way", __pyx_getprop_6osmium_8examples_14ExampleHandler_saved_way, __pyx_setprop_6osmium_8examples_14ExampleHandler_saved_way, 0, 0},
  {(char *)"saved_relation", __pyx_getprop_6osmium_8examples_14ExampleHandler_saved_relation, __pyx_setprop_6osmium_8examples_14ExampleHandler_saved_relation, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ExampleHandler = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ExampleHandler = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ExampleHandler = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ExampleHandler = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_6osmium_8examples_ExampleHandler = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("osmium.examples.ExampleHandler"), /*tp_name*/
  sizeof(struct __pyx_obj_6osmium_8examples_ExampleHandler), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6osmium_8examples_ExampleHandler, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ExampleHandler, /*tp_as_number*/
  &__pyx_tp_as_sequence_ExampleHandler, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ExampleHandler, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ExampleHandler, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_6osmium_8examples_ExampleHandler, /*tp_traverse*/
  __pyx_tp_clear_6osmium_8examples_ExampleHandler, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6osmium_8examples_ExampleHandler, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6osmium_8examples_ExampleHandler, /*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*/
  __pyx_tp_new_6osmium_8examples_ExampleHandler, /*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*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("examples"),
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0},
  {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0},
  {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0},
  {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0},
  {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0},
  {&__pyx_n_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 1},
  {&__pyx_n_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 1},
  {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0},
  {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0},
  {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
  {&__pyx_n_s__Base, __pyx_k__Base, sizeof(__pyx_k__Base), 0, 0, 1, 1},
  {&__pyx_n_s__Debug, __pyx_k__Debug, sizeof(__pyx_k__Debug), 0, 0, 1, 1},
  {&__pyx_n_s__FINAL, __pyx_k__FINAL, sizeof(__pyx_k__FINAL), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__after_nodes, __pyx_k__after_nodes, sizeof(__pyx_k__after_nodes), 0, 0, 1, 1},
  {&__pyx_n_s__after_relations, __pyx_k__after_relations, sizeof(__pyx_k__after_relations), 0, 0, 1, 1},
  {&__pyx_n_s__after_ways, __pyx_k__after_ways, sizeof(__pyx_k__after_ways), 0, 0, 1, 1},
  {&__pyx_n_s__before_nodes, __pyx_k__before_nodes, sizeof(__pyx_k__before_nodes), 0, 0, 1, 1},
  {&__pyx_n_s__before_relations, __pyx_k__before_relations, sizeof(__pyx_k__before_relations), 0, 0, 1, 1},
  {&__pyx_n_s__before_ways, __pyx_k__before_ways, sizeof(__pyx_k__before_ways), 0, 0, 1, 1},
  {&__pyx_n_s__debug_read, __pyx_k__debug_read, sizeof(__pyx_k__debug_read), 0, 0, 1, 1},
  {&__pyx_n_s__final, __pyx_k__final, sizeof(__pyx_k__final), 0, 0, 1, 1},
  {&__pyx_n_s__init, __pyx_k__init, sizeof(__pyx_k__init), 0, 0, 1, 1},
  {&__pyx_n_s__members, __pyx_k__members, sizeof(__pyx_k__members), 0, 0, 1, 1},
  {&__pyx_n_s__node, __pyx_k__node, sizeof(__pyx_k__node), 0, 0, 1, 1},
  {&__pyx_n_s__nodes, __pyx_k__nodes, sizeof(__pyx_k__nodes), 0, 0, 1, 1},
  {&__pyx_n_s__read_file, __pyx_k__read_file, sizeof(__pyx_k__read_file), 0, 0, 1, 1},
  {&__pyx_n_s__relation, __pyx_k__relation, sizeof(__pyx_k__relation), 0, 0, 1, 1},
  {&__pyx_n_s__tags, __pyx_k__tags, sizeof(__pyx_k__tags), 0, 0, 1, 1},
  {&__pyx_n_s__way, __pyx_k__way, sizeof(__pyx_k__way), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  return 0;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants");
  __Pyx_RefNannyFinishContext();
  return 0;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initexamples(void); /*proto*/
PyMODINIT_FUNC initexamples(void)
#else
PyMODINIT_FUNC PyInit_examples(void); /*proto*/
PyMODINIT_FUNC PyInit_examples(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_examples(void)");
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __pyx_binding_PyCFunctionType_USED
  if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("examples"), __pyx_methods, 0, 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_osmium__examples) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  __pyx_ptype_6osmium_7handler_Base = __Pyx_ImportType("osmium.handler", "Base", sizeof(struct osmhandler_struct), 1); if (unlikely(!__pyx_ptype_6osmium_7handler_Base)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_6osmium_7handler_Base = (struct __pyx_vtabstruct_6osmium_7handler_Base*)__Pyx_GetVtable(__pyx_ptype_6osmium_7handler_Base->tp_dict); if (unlikely(!__pyx_vtabptr_6osmium_7handler_Base)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_6osmium_8examples_ExampleHandler = &__pyx_vtable_6osmium_8examples_ExampleHandler;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base = *__pyx_vtabptr_6osmium_7handler_Base;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.init = (PyObject *(*)(struct osmhandler_struct *, struct __pyx_obj_6osmium_3osm_Meta *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_init;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.before_nodes = (PyObject *(*)(struct osmhandler_struct *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_before_nodes;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.node = (PyObject *(*)(struct osmhandler_struct *, struct __pyx_obj_6osmium_3osm_Node *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_node;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.after_nodes = (PyObject *(*)(struct osmhandler_struct *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_after_nodes;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.before_ways = (PyObject *(*)(struct osmhandler_struct *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_before_ways;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.way = (PyObject *(*)(struct osmhandler_struct *, struct __pyx_obj_6osmium_3osm_Way *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_way;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.after_ways = (PyObject *(*)(struct osmhandler_struct *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_after_ways;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.before_relations = (PyObject *(*)(struct osmhandler_struct *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_before_relations;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.relation = (PyObject *(*)(struct osmhandler_struct *, struct __pyx_obj_6osmium_3osm_Relation *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_relation;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.after_relations = (PyObject *(*)(struct osmhandler_struct *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_after_relations;
  __pyx_vtable_6osmium_8examples_ExampleHandler.__pyx_base.final = (PyObject *(*)(struct osmhandler_struct *, int __pyx_skip_dispatch))__pyx_f_6osmium_8examples_14ExampleHandler_final;
  __pyx_type_6osmium_8examples_ExampleHandler.tp_base = __pyx_ptype_6osmium_7handler_Base;
  if (PyType_Ready(&__pyx_type_6osmium_8examples_ExampleHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetVtable(__pyx_type_6osmium_8examples_ExampleHandler.tp_dict, __pyx_vtabptr_6osmium_8examples_ExampleHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ExampleHandler", (PyObject *)&__pyx_type_6osmium_8examples_ExampleHandler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_8examples_ExampleHandler = &__pyx_type_6osmium_8examples_ExampleHandler;
  /*--- Type import code ---*/
  __pyx_ptype_6osmium_3osm_TagList = __Pyx_ImportType("osmium.osm", "TagList", sizeof(struct __pyx_obj_6osmium_3osm_TagList), 1); if (unlikely(!__pyx_ptype_6osmium_3osm_TagList)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_3osm_WayNodeList = __Pyx_ImportType("osmium.osm", "WayNodeList", sizeof(struct __pyx_obj_6osmium_3osm_WayNodeList), 1); if (unlikely(!__pyx_ptype_6osmium_3osm_WayNodeList)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_3osm_RelationMemberList = __Pyx_ImportType("osmium.osm", "RelationMemberList", sizeof(struct __pyx_obj_6osmium_3osm_RelationMemberList), 1); if (unlikely(!__pyx_ptype_6osmium_3osm_RelationMemberList)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_3osm_Object = __Pyx_ImportType("osmium.osm", "Object", sizeof(struct __pyx_obj_6osmium_3osm_Object), 1); if (unlikely(!__pyx_ptype_6osmium_3osm_Object)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_3osm_Node = __Pyx_ImportType("osmium.osm", "Node", sizeof(struct __pyx_obj_6osmium_3osm_Node), 1); if (unlikely(!__pyx_ptype_6osmium_3osm_Node)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_3osm_Way = __Pyx_ImportType("osmium.osm", "Way", sizeof(struct __pyx_obj_6osmium_3osm_Way), 1); if (unlikely(!__pyx_ptype_6osmium_3osm_Way)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_3osm_Relation = __Pyx_ImportType("osmium.osm", "Relation", sizeof(struct __pyx_obj_6osmium_3osm_Relation), 1); if (unlikely(!__pyx_ptype_6osmium_3osm_Relation)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_3osm_Bounds = __Pyx_ImportType("osmium.osm", "Bounds", sizeof(struct __pyx_obj_6osmium_3osm_Bounds), 1); if (unlikely(!__pyx_ptype_6osmium_3osm_Bounds)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_3osm_Meta = __Pyx_ImportType("osmium.osm", "Meta", sizeof(struct __pyx_obj_6osmium_3osm_Meta), 1); if (unlikely(!__pyx_ptype_6osmium_3osm_Meta)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_6osmium_3osm_Meta = (struct __pyx_vtabstruct_6osmium_3osm_Meta*)__Pyx_GetVtable(__pyx_ptype_6osmium_3osm_Meta->tp_dict); if (unlikely(!__pyx_vtabptr_6osmium_3osm_Meta)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_7handler_Exception = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "Exception", sizeof(PyBaseExceptionObject), 0); if (unlikely(!__pyx_ptype_6osmium_7handler_Exception)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_7handler_StopReading = __Pyx_ImportType("osmium.handler", "StopReading", sizeof(struct StopReading_struct), 1); if (unlikely(!__pyx_ptype_6osmium_7handler_StopReading)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_7handler_Debug = __Pyx_ImportType("osmium.handler", "Debug", sizeof(struct __pyx_obj_6osmium_7handler_Debug), 1); if (unlikely(!__pyx_ptype_6osmium_7handler_Debug)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_6osmium_7handler_Debug = (struct __pyx_vtabstruct_6osmium_7handler_Debug*)__Pyx_GetVtable(__pyx_ptype_6osmium_7handler_Debug->tp_dict); if (unlikely(!__pyx_vtabptr_6osmium_7handler_Debug)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_7handler_Progress = __Pyx_ImportType("osmium.handler", "Progress", sizeof(struct __pyx_obj_6osmium_7handler_Progress), 1); if (unlikely(!__pyx_ptype_6osmium_7handler_Progress)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_6osmium_7handler_Progress = (struct __pyx_vtabstruct_6osmium_7handler_Progress*)__Pyx_GetVtable(__pyx_ptype_6osmium_7handler_Progress->tp_dict); if (unlikely(!__pyx_vtabptr_6osmium_7handler_Progress)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_7handler_Tee = __Pyx_ImportType("osmium.handler", "Tee", sizeof(struct __pyx_obj_6osmium_7handler_Tee), 1); if (unlikely(!__pyx_ptype_6osmium_7handler_Tee)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_6osmium_7handler_Tee = (struct __pyx_vtabstruct_6osmium_7handler_Tee*)__Pyx_GetVtable(__pyx_ptype_6osmium_7handler_Tee->tp_dict); if (unlikely(!__pyx_vtabptr_6osmium_7handler_Tee)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_6osmium_7handler_Forward = __Pyx_ImportType("osmium.handler", "Forward", sizeof(struct __pyx_obj_6osmium_7handler_Forward), 1); if (unlikely(!__pyx_ptype_6osmium_7handler_Forward)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_vtabptr_6osmium_7handler_Forward = (struct __pyx_vtabstruct_6osmium_7handler_Forward*)__Pyx_GetVtable(__pyx_ptype_6osmium_7handler_Forward->tp_dict); if (unlikely(!__pyx_vtabptr_6osmium_7handler_Forward)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Variable import code ---*/
  __pyx_t_1 = __Pyx_ImportModule("osmium.osm"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "_cache_node", (void **)&__pyx_vp_6osmium_3osm__cache_node, "struct __pyx_obj_6osmium_3osm_Node *") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "_cache_way", (void **)&__pyx_vp_6osmium_3osm__cache_way, "struct __pyx_obj_6osmium_3osm_Way *") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "_cache_relation", (void **)&__pyx_vp_6osmium_3osm__cache_relation, "struct __pyx_obj_6osmium_3osm_Relation *") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "_cache_taglist", (void **)&__pyx_vp_6osmium_3osm__cache_taglist, "struct __pyx_obj_6osmium_3osm_TagList *") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "_cache_waynodelist", (void **)&__pyx_vp_6osmium_3osm__cache_waynodelist, "struct __pyx_obj_6osmium_3osm_WayNodeList *") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_ImportVoidPtr(__pyx_t_1, "_cache_relationmemberlist", (void **)&__pyx_vp_6osmium_3osm__cache_relationmemberlist, "struct __pyx_obj_6osmium_3osm_RelationMemberList *") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "osmium/examples.pyx":7
 * 
 * from osmium.handler cimport Base as osmhandler, Debug as debug_handler
 * from osmium.handler import Base as osmhandler, Debug as debug_handler             # <<<<<<<<<<<<<<
 * from osmium.handler cimport Meta, Node, Way, Relation
 * 
 */
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_2));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Base));
  PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__Base));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Base));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__Debug));
  PyList_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_n_s__Debug));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Debug));
  __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_15), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "osmium/examples.pyx":10
 * from osmium.handler cimport Meta, Node, Way, Relation
 * 
 * def read_file(name):             # <<<<<<<<<<<<<<
 *     c_osmium.init(True)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6osmium_8examples_read_file, NULL, __pyx_n_s_16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__read_file, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "osmium/examples.pyx":21
 *     python_handler.handle_infile(infile)
 * 
 * def debug_read(name):             # <<<<<<<<<<<<<<
 *     c_osmium.init(True)
 * 
 */
  __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_6osmium_8examples_1debug_read, NULL, __pyx_n_s_16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__debug_read, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "osmium/examples.pyx":1
 * from libcpp.string cimport string             # <<<<<<<<<<<<<<
 * 
 * cimport c_osmium
 */
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  if (__pyx_m) {
    __Pyx_AddTraceback("init osmium.examples", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init osmium.examples");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */

#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
    const char *name, int exact)
{
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (none_allowed && obj == Py_None) return 1;
    else if (exact) {
        if (Py_TYPE(obj) == type) return 1;
    }
    else {
        if (PyObject_TypeCheck(obj, type)) return 1;
    }
    PyErr_Format(PyExc_TypeError,
        "Argument '%s' has incorrect type (expected %s, got %s)",
        name, type->tp_name, Py_TYPE(obj)->tp_name);
    return 0;
}

static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (unlikely(!type)) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (likely(PyObject_TypeCheck(obj, type)))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
                 Py_TYPE(obj)->tp_name, type->tp_name);
    return 0;
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) {
    PyObject *py_import = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    py_import = __Pyx_GetAttrString(__pyx_b, "__import__");
    if (!py_import)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    #if PY_VERSION_HEX >= 0x02050000
    {
        PyObject *py_level = PyInt_FromLong(level);
        if (!py_level)
            goto bad;
        module = PyObject_CallFunctionObjArgs(py_import,
            name, global_dict, empty_dict, list, py_level, NULL);
        Py_DECREF(py_level);
    }
    #else
    if (level>0) {
        PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4.");
        goto bad;
    }
    module = PyObject_CallFunctionObjArgs(py_import,
        name, global_dict, empty_dict, list, NULL);
    #endif
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(py_import);
    Py_XDECREF(empty_dict);
    return module;
}

#if PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}

static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
    PyObject* v;
    int i;

    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                return -1;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            return -1;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0 &&
                isspace(Py_CHARMASK(s[len-1])) &&
                s[len-1] != ' ')
                    PyFile_SoftSpace(f, 0);
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            return -1;
        PyFile_SoftSpace(f, 0);
    }
    return 0;
}

#else /* Python 3 has a print function */

static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (unlikely(!__pyx_print)) {
        __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
        if (!__pyx_print)
            return -1;
    }
    if (stream) {
        kwargs = PyDict_New();
        if (unlikely(!kwargs))
            return -1;
        if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0))
            goto bad;
        if (!newline) {
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                goto bad;
            if (PyDict_SetItemString(kwargs, "end", end_string) < 0) {
                Py_DECREF(end_string);
                goto bad;
            }
            Py_DECREF(end_string);
        }
    } else if (!newline) {
        if (unlikely(!__pyx_print_kwargs)) {
            __pyx_print_kwargs = PyDict_New();
            if (unlikely(!__pyx_print_kwargs))
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                return -1;
            if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
        Py_DECREF(kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
bad:
    if (kwargs != __pyx_print_kwargs)
        Py_XDECREF(kwargs);
    return -1;
}

#endif

#if PY_MAJOR_VERSION < 3

static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            return -1;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        return -1;
    if (PyFile_WriteString("\n", f) < 0)
        return -1;
    return 0;
    /* the line below is just to avoid compiler
     * compiler warnings about unused functions */
    return __Pyx_Print(f, NULL, 0);
}

#else /* Python 3 has a print function */

static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
    int res;
    PyObject* arg_tuple = PyTuple_New(1);
    if (unlikely(!arg_tuple))
        return -1;
    Py_INCREF(o);
    PyTuple_SET_ITEM(arg_tuple, 0, o);
    res = __Pyx_Print(stream, arg_tuple, 1);
    Py_DECREF(arg_tuple);
    return res;
}

#endif

static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_osm_object_id_t(osm_object_id_t val) {
    const osm_object_id_t neg_one = (osm_object_id_t)-1, const_zero = (osm_object_id_t)0;
    const int is_unsigned = const_zero < neg_one;
    if ((sizeof(osm_object_id_t) == sizeof(char))  ||
        (sizeof(osm_object_id_t) == sizeof(short))) {
        return PyInt_FromLong((long)val);
    } else if ((sizeof(osm_object_id_t) == sizeof(int)) ||
               (sizeof(osm_object_id_t) == sizeof(long))) {
        if (is_unsigned)
            return PyLong_FromUnsignedLong((unsigned long)val);
        else
            return PyInt_FromLong((long)val);
    } else if (sizeof(osm_object_id_t) == sizeof(PY_LONG_LONG)) {
        if (is_unsigned)
            return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val);
        else
            return PyLong_FromLongLong((PY_LONG_LONG)val);
    } else {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&val;
        return _PyLong_FromByteArray(bytes, sizeof(osm_object_id_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

#ifndef __PYX_HAVE_RT_ImportType
#define __PYX_HAVE_RT_ImportType
static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
    size_t size, int strict)
{
    PyObject *py_module = 0;
    PyObject *result = 0;
    PyObject *py_name = 0;
    char warning[200];

    py_module = __Pyx_ImportModule(module_name);
    if (!py_module)
        goto bad;
    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(class_name);
    #else
    py_name = PyUnicode_FromString(class_name);
    #endif
    if (!py_name)
        goto bad;
    result = PyObject_GetAttr(py_module, py_name);
    Py_DECREF(py_name);
    py_name = 0;
    Py_DECREF(py_module);
    py_module = 0;
    if (!result)
        goto bad;
    if (!PyType_Check(result)) {
        PyErr_Format(PyExc_TypeError,
            "%s.%s is not a type object",
            module_name, class_name);
        goto bad;
    }
    if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) {
        PyOS_snprintf(warning, sizeof(warning),
            "%s.%s size changed, may indicate binary incompatibility",
            module_name, class_name);
        #if PY_VERSION_HEX < 0x02050000
        if (PyErr_Warn(NULL, warning) < 0) goto bad;
        #else
        if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
        #endif
    }
    else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) {
        PyErr_Format(PyExc_ValueError,
            "%s.%s has the wrong size, try recompiling",
            module_name, class_name);
        goto bad;
    }
    return (PyTypeObject *)result;
bad:
    Py_XDECREF(py_module);
    Py_XDECREF(result);
    return NULL;
}
#endif

#ifndef __PYX_HAVE_RT_ImportModule
#define __PYX_HAVE_RT_ImportModule
static PyObject *__Pyx_ImportModule(const char *name) {
    PyObject *py_name = 0;
    PyObject *py_module = 0;

    #if PY_MAJOR_VERSION < 3
    py_name = PyString_FromString(name);
    #else
    py_name = PyUnicode_FromString(name);
    #endif
    if (!py_name)
        goto bad;
    py_module = PyImport_Import(py_name);
    Py_DECREF(py_name);
    return py_module;
bad:
    Py_XDECREF(py_name);
    return 0;
}
#endif

static void* __Pyx_GetVtable(PyObject *dict) {
    void* ptr;
    PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__");
    if (!ob)
        goto bad;
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    ptr = PyCapsule_GetPointer(ob, 0);
#else
    ptr = PyCObject_AsVoidPtr(ob);
#endif
    if (!ptr && !PyErr_Occurred())
        PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
    Py_DECREF(ob);
    return ptr;
bad:
    Py_XDECREF(ob);
    return NULL;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    PyObject *ob = PyCapsule_New(vtable, 0, 0);
#else
    PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
#endif
    if (!ob)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0)
        goto bad;
    Py_DECREF(ob);
    return 0;
bad:
    Py_XDECREF(ob);
    return -1;
}

#ifndef __PYX_HAVE_RT_ImportVoidPtr
#define __PYX_HAVE_RT_ImportVoidPtr
static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) {
    PyObject *d = 0;
    PyObject *cobj = 0;

    d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
    if (!d)
        goto bad;
    cobj = PyDict_GetItemString(d, name);
    if (!cobj) {
        PyErr_Format(PyExc_ImportError,
            "%s does not export expected C variable %s",
                PyModule_GetName(module), name);
        goto bad;
    }
#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0)
    if (!PyCapsule_IsValid(cobj, sig)) {
        PyErr_Format(PyExc_TypeError,
            "C variable %s.%s has wrong signature (expected %s, got %s)",
             PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj));
        goto bad;
    }
    *p = PyCapsule_GetPointer(cobj, sig);
#else
    {const char *desc, *s1, *s2;
    desc = (const char *)PyCObject_GetDesc(cobj);
    if (!desc)
        goto bad;
    s1 = desc; s2 = sig;
    while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
    if (*s1 != *s2) {
        PyErr_Format(PyExc_TypeError,
            "C variable %s.%s has wrong signature (expected %s, got %s)",
             PyModule_GetName(module), name, sig, desc);
        goto bad;
    }
    *p = PyCObject_AsVoidPtr(cobj);}
#endif
    if (!(*p))
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(d);
    return -1;
}
#endif

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
                               int __pyx_lineno, const char *__pyx_filename) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;

    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(__pyx_filename);
    #else
    py_srcfile = PyUnicode_FromString(__pyx_filename);
    #endif
    if (!py_srcfile) goto bad;
    if (__pyx_clineno) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        #if PY_MAJOR_VERSION >= 3
        0,            /*int kwonlyargcount,*/
        #endif
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple,  /*PyObject *consts,*/
        __pyx_empty_tuple,  /*PyObject *names,*/
        __pyx_empty_tuple,  /*PyObject *varnames,*/
        __pyx_empty_tuple,  /*PyObject *freevars,*/
        __pyx_empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
