'Subclass the Pickler `save` method.
This is a total abuse of the Pickler class in order to use the numpy
persistence function `save` instead of the default pickle
implementation. The numpy array is replaced by a custom wrapper in the
pickle persistence stack and the serialized array is written right
after in the file. Warning: the file produced does not follow the
pickle format. As such it can not be read with `pickle.load`.'

def save(self, obj):

    if ((self.np is not None) and (type(obj) in (self.np.ndarray, self.np.matrix, self.np.memmap))):
        if (type(obj) is self.np.memmap):
            obj = self.np.asanyarray(obj)
        wrapper = self._create_array_wrapper(obj)
        Pickler.save(self, wrapper)
        if (self.proto >= 4):
            self.framer.commit_frame(force=True)
        wrapper.write_array(obj, self)
        return
    return Pickler.save(self, obj)
