<s> import types <EOL> from modjy_exceptions import * <EOL> class write_object : <EOL> def __init__ ( self , ostream ) : <EOL> self . ostream = ostream <EOL> self . num_writes = <NUM_LIT:0> <EOL> def __call__ ( self , * args , ** keywords ) : <EOL> if len ( args ) != <NUM_LIT:1> or not isinstance ( args [ <NUM_LIT:0> ] , types . StringTypes ) : <EOL> raise NonStringOutput ( "<STR_LIT>" ) <EOL> try : <EOL> self . ostream . write ( args [ <NUM_LIT:0> ] ) <EOL> self . ostream . flush ( ) <EOL> self . num_writes += <NUM_LIT:1> <EOL> except Exception , x : <EOL> raise ModjyIOException ( x ) </s>
