<s> """<STR_LIT>""" <EOL> import sys <EOL> if sys . version_info [ <NUM_LIT:0> ] < <NUM_LIT:3> : <EOL> from urllib import unquote <EOL> from urlparse import parse_qs , urlparse <EOL> from itertools import imap , izip <EOL> from string import letters as ascii_letters <EOL> from Queue import Queue <EOL> try : <EOL> from cStringIO import StringIO as BytesIO <EOL> except ImportError : <EOL> from StringIO import StringIO as BytesIO <EOL> def safe_unicode ( obj , * args ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> return unicode ( obj , * args ) <EOL> except UnicodeDecodeError : <EOL> ascii_text = str ( obj ) . encode ( '<STR_LIT>' ) <EOL> return unicode ( ascii_text ) <EOL> def iteritems ( x ) : <EOL> return x . iteritems ( ) <EOL> def iterkeys ( x ) : <EOL> return x . iterkeys ( ) <EOL> def itervalues ( x ) : <EOL> return x . itervalues ( ) <EOL> def nativestr ( x ) : <EOL> return x if isinstance ( x , str ) else x . encode ( '<STR_LIT:utf-8>' , '<STR_LIT:replace>' ) <EOL> def u ( x ) : <EOL> return x . decode ( ) <EOL> def b ( x ) : <EOL> return x <EOL> def next ( x ) : <EOL> return x . next ( ) <EOL> def byte_to_chr ( x ) : <EOL> return x <EOL> unichr = unichr <EOL> xrange = xrange <EOL> basestring = basestring <EOL> unicode = unicode <EOL> bytes = str <EOL> long = long <EOL> else : <EOL> from urllib . parse import parse_qs , unquote , urlparse <EOL> from io import BytesIO <EOL> from string import ascii_letters <EOL> from queue import Queue <EOL> def iteritems ( x ) : <EOL> return iter ( x . items ( ) ) <EOL> def iterkeys ( x ) : <EOL> return iter ( x . keys ( ) ) <EOL> def itervalues ( x ) : <EOL> return iter ( x . values ( ) ) <EOL> def byte_to_chr ( x ) : <EOL> return chr ( x ) <EOL> def nativestr ( x ) : <EOL> return x if isinstance ( x , str ) else x . decode ( '<STR_LIT:utf-8>' , '<STR_LIT:replace>' ) <EOL> def u ( x ) : <EOL> return x <EOL> def b ( x ) : <EOL> return x . encode ( '<STR_LIT>' ) if not isinstance ( x , bytes ) else x <EOL> next = next <EOL> unichr = chr <EOL> imap = map <EOL> izip = zip <EOL> xrange = range <EOL> basestring = str <EOL> unicode = str <EOL> safe_unicode = str <EOL> bytes = bytes <EOL> long = int <EOL> try : <EOL> from queue import LifoQueue , Empty , Full <EOL> except ImportError : <EOL> from Queue import Empty , Full <EOL> try : <EOL> from Queue import LifoQueue <EOL> except ImportError : <EOL> from Queue import Queue <EOL> class LifoQueue ( Queue ) : <EOL> "<STR_LIT>" <EOL> def _init ( self , maxsize ) : <EOL> self . maxsize = maxsize <EOL> self . queue = [ ] <EOL> def _qsize ( self , len = len ) : <EOL> return len ( self . queue ) <EOL> def _put ( self , item ) : <EOL> self . queue . append ( item ) <EOL> def _get ( self ) : <EOL> return self . queue . pop ( ) </s>
