def clean_default(widget_type, default):
 if (widget_type != 'CheckBox'):
  return (default.__name__ if callable(default) else default)
 return (default if isinstance(default, bool) else False)

def clean_default ( widget_type , default ) : if ( widget_type != 'CheckBox' ) : return ( default . __name__ if callable ( default ) else default ) return ( default if isinstance ( default , bool ) else False )
attemps to safely coalesce the default value down to a valid json type .