def _encode(xdata):
        """Pickle a dict object and return data, which can be saved in DB"""
        if not isinstance(xdata, dict):
            raise ValueError('json is not a dict')
        return base64.encodestring(pickle.dumps(copy.copy(dict(xdata))))