def make_vals(val, klass, klass_inst=None, prop=None, part=False, base64encode=False):
 cinst = None
 if isinstance(val, dict):
  cinst = klass().loadd(val, base64encode=base64encode)
 else:
  try:
   cinst = klass().set_text(val)
  except ValueError:
   if (not part):
    cis = [make_vals(sval, klass, klass_inst, prop, True, base64encode) for sval in val]
    setattr(klass_inst, prop, cis)
   else:
    raise
 if part:
  return cinst
 elif cinst:
  cis = [cinst]
  setattr(klass_inst, prop, cis)

def make_vals ( val , klass , klass_inst = None , prop = None , part = False , base64encode = False ) : cinst = None if isinstance ( val , dict ) : cinst = klass ( ) . loadd ( val , base64encode = base64encode ) else : try : cinst = klass ( ) . set_text ( val ) except ValueError : if ( not part ) : cis = [ make_vals ( sval , klass , klass_inst , prop , True , base64encode ) for sval in val ] setattr ( klass_inst , prop , cis ) else : raise if part : return cinst elif cinst : cis = [ cinst ] setattr ( klass_inst , prop , cis )
creates a class instance with a specified value .