def StringIO(*args, **kw):
 global StringIO
 try:
  from cStringIO import StringIO
 except ImportError:
  from StringIO import StringIO
 return StringIO(*args, **kw)

def StringIO ( * args , ** kw ) : global StringIO try : from cStringIO import StringIO except ImportError : from StringIO import StringIO return StringIO ( * args , ** kw )
thunk to load the real stringio on demand .