def baseTransform(val):
 from pybrain.structure.modules.module import Module
 from inspect import isclass
 if isinstance(val, Module):
  return val.name
 elif isclass(val):
  return val.__name__
 else:
  return str(val)

def baseTransform ( val ) : from pybrain . structure . modules . module import Module from inspect import isclass if isinstance ( val , Module ) : return val . name elif isclass ( val ) : return val . __name__ else : return str ( val )
back-conversion: modules are encoded by their name and classes by the classname .