def base64unpickle(value, unsafe=False):
 retVal = None
 def _(self):
  if (len(self.stack) > 1):
   func = self.stack[(-2)]
   if (func not in PICKLE_REDUCE_WHITELIST):
    raise Exception, 'abusing reduce() is bad, Mkay!'
  self.load_reduce()
 def loads(str):
  f = StringIO.StringIO(str)
  if unsafe:
   unpickler = picklePy.Unpickler(f)
   unpickler.dispatch[picklePy.REDUCE] = _
  else:
   unpickler = pickle.Unpickler(f)
  return unpickler.load()
 try:
  retVal = loads(base64decode(value))
 except TypeError:
  retVal = loads(base64decode(bytes(value)))
 return retVal

def base64unpickle ( value , unsafe = False ) : retVal = None def _ ( self ) : if ( len ( self . stack ) > 1 ) : func = self . stack [ ( - 2 ) ] if ( func not in PICKLE_REDUCE_WHITELIST ) : raise Exception , 'abusing reduce() is bad, Mkay!' self . load_reduce ( ) def loads ( str ) : f = StringIO . StringIO ( str ) if unsafe : unpickler = picklePy . Unpickler ( f ) unpickler . dispatch [ picklePy . REDUCE ] = _ else : unpickler = pickle . Unpickler ( f ) return unpickler . load ( ) try : retVal = loads ( base64decode ( value ) ) except TypeError : retVal = loads ( base64decode ( bytes ( value ) ) ) return retVal
decodes value from base64 to plain format and deserializes its content .