diff --git a/swig/boost_shared_ptr.i b/swig/boost_shared_ptr.i
index 7803b22154c79cba53773442e3387ca0e466f7da..6f3ec42a0061504e01d2802c46156964fa3928fe 100644
--- a/swig/boost_shared_ptr.i
+++ b/swig/boost_shared_ptr.i
@@ -14,6 +14,14 @@ namespace boost {
     shared_ptr();
     shared_ptr(T * p);
     T* operator->();
+    T* get();
+
+%pythoncode %{
+  def __bool__(self):
+     return self.get() is not None
+  __nonzero__=__bool__
+%}
+
   private:
     T * px;
     int pn;