def format_option_value(optdict, value):
 if isinstance(value, (list, tuple)):
  value = ','.join(value)
 elif isinstance(value, dict):
  value = ','.join([('%s:%s' % (k, v)) for (k, v) in value.items()])
 elif hasattr(value, 'match'):
  value = value.pattern
 elif (optdict.get('type') == 'yn'):
  value = ((value and 'yes') or 'no')
 elif (isinstance(value, string_types) and value.isspace()):
  value = ("'%s'" % value)
 elif ((optdict.get('type') == 'time') and isinstance(value, (float, int, long))):
  value = format_time(value)
 elif ((optdict.get('type') == 'bytes') and hasattr(value, '__int__')):
  value = format_bytes(value)
 return value

def format_option_value ( optdict , value ) : if isinstance ( value , ( list , tuple ) ) : value = ',' . join ( value ) elif isinstance ( value , dict ) : value = ',' . join ( [ ( '%s:%s' % ( k , v ) ) for ( k , v ) in value . items ( ) ] ) elif hasattr ( value , 'match' ) : value = value . pattern elif ( optdict . get ( 'type' ) == 'yn' ) : value = ( ( value and 'yes' ) or 'no' ) elif ( isinstance ( value , string_types ) and value . isspace ( ) ) : value = ( "'%s'" % value ) elif ( ( optdict . get ( 'type' ) == 'time' ) and isinstance ( value , ( float , int , long ) ) ) : value = format_time ( value ) elif ( ( optdict . get ( 'type' ) == 'bytes' ) and hasattr ( value , '__int__' ) ) : value = format_bytes ( value ) return value
return the user inputs value from a compiled value .