def toType( value, classType, allowNone=False, name="" ):
   pName = name
   if name:
      name = " '%s'" % name

   assert( classType in _allowed )

   try:
      result = toInstance( value, classType, allowNone, name=pName )
      return result
   except Exception, e:
      msg = "%s\nError trying to convert an input to a Python type '%s'.\n" \
            "Input%s: %s" % ( e, classType.__name__, name, value )
      raise Exception( msg )

#===========================================================================
Serialize to json format
dataset/ETHPy150Open nasa/mplStyle/mplStyle/types/convert/toType.py/toType--crossover with--dataset/ETHPy150Open bloomreach/briefly/src/briefly/properties.py/Properties.to_json