def subclass_exception(name, parents, module, attached_to=None):
 class_dict = {u'__module__': module}
 if (attached_to is not None):
  def __reduce__(self):
   return (unpickle_inner_exception, (attached_to, name), self.args)
  def __setstate__(self, args):
   self.args = args
  class_dict[u'__reduce__'] = __reduce__
  class_dict[u'__setstate__'] = __setstate__
 return type(name, parents, class_dict)

def subclass_exception ( name , parents , module , attached_to = None ) : class_dict = { u'__module__' : module } if ( attached_to is not None ) : def __reduce__ ( self ) : return ( unpickle_inner_exception , ( attached_to , name ) , self . args ) def __setstate__ ( self , args ) : self . args = args class_dict [ u'__reduce__' ] = __reduce__ class_dict [ u'__setstate__' ] = __setstate__ return type ( name , parents , class_dict )
create new exception class .