<s> import sys <EOL> from decimal import Decimal <EOL> try : <EOL> from StringIO import StringIO <EOL> except ImportError : <EOL> from io import StringIO <EOL> try : <EOL> from fractions import Fraction <EOL> except ImportError : <EOL> Fraction = float <EOL> try : <EOL> from collections import defaultdict <EOL> from collections import namedtuple <EOL> except ImportError : <EOL> from . compat_collections import defaultdict <EOL> from . compat_collections import namedtuple <EOL> if sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:2> : <EOL> num_types = ( float , int , long , Decimal , Fraction ) <EOL> str_types = basestring <EOL> else : <EOL> num_types = ( float , int , Decimal , Fraction ) <EOL> str_types = str <EOL> if sys . version_info < ( <NUM_LIT:2> , <NUM_LIT:6> , <NUM_LIT:0> ) : <EOL> from StringIO import StringIO as BytesIO <EOL> else : <EOL> from io import BytesIO as BytesIO <EOL> def force_unicode ( string ) : <EOL> """<STR_LIT>""" <EOL> if sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:2> : <EOL> if isinstance ( string , unicode ) : <EOL> return string . encode ( '<STR_LIT:utf-8>' ) <EOL> return string </s>
