<s> import sys <EOL> try : <EOL> import StringIO <EOL> import cStringIO <EOL> except ImportError : <EOL> from io import BytesIO <EOL> running_python_3 = sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:3> <EOL> def range_fn ( * args ) : <EOL> if running_python_3 : <EOL> return range ( * args ) <EOL> else : <EOL> return xrange ( * args ) <EOL> def is_string_io ( instance ) : <EOL> if running_python_3 : <EOL> return isinstance ( instance , BytesIO ) <EOL> else : <EOL> return isinstance ( instance , ( StringIO . StringIO , <EOL> cStringIO . InputType , <EOL> cStringIO . OutputType ) ) </s>
