Pickling BlockState

I have tried to figure out why pickling a BlockState doesn't work for me, here is the code I tried:

from graph_tool import collection
from graph_tool.community import minimize_blockmodel_dl
import cPickle as pickle
g = collection.data['polbooks']
block = minimize_blockmodel_dl(g)
pickle.dump(block, open(u'block.p', u'wb'))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-42-72ab45d5f5f1> in <module>()
      4 g = collection.data['polbooks']
      5 block = minimize_blockmodel_dl(g)
----> 6 pickle.dump(block, open(u'block.p', u'wb'))

/usr/lib/python2.7/copy_reg.pyc in _reduce_ex(self, proto)
     82             dict = None
     83     else:
---> 84         dict = getstate()
     85     if dict:
     86         return _reconstructor, args, dict

/usr/lib/python2.7/dist-packages/graph_tool/__init__.pyc in __getstate__(self)
   2155         state = dict()
   2156         sio = BytesIO()
-> 2157         stream = gzip.open(sio, mode="wb")
   2158         self.save(stream, "gt")
   2159         stream.close()

/usr/lib/python2.7/gzip.pyc in open(filename, mode, compresslevel)
     32 
     33     """
---> 34     return GzipFile(filename, mode, compresslevel)
     35 
     36 class GzipFile(io.BufferedIOBase):

/usr/lib/python2.7/gzip.pyc in __init__(self, filename, mode, compresslevel, fileobj, mtime)
     92             mode += 'b'
     93         if fileobj is None:
---> 94             fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
     95         if filename is None:
     96             # Issue #13781: os.fdopen() creates a fileobj with a bogus name

TypeError: coercing to Unicode: need string or buffer, _io.BytesIO found


graph_tool.__version__
'2.2.36dev (commit f4111815, Thu Sep 25 17:22:05 2014 +0200)'

Does the same code work for you?