def _select(readers=None, writers=None, err=None, timeout=0, poll=_select_imp):
 readers = (set() if (readers is None) else readers)
 writers = (set() if (writers is None) else writers)
 err = (set() if (err is None) else err)
 try:
  return poll(readers, writers, err, timeout)
 except (select.error, socket.error) as exc:
  if (exc.errno == errno.EINTR):
   return (set(), set(), 1)
  elif (exc.errno in SELECT_BAD_FD):
   for fd in ((readers | writers) | err):
    try:
     select.select([fd], [], [], 0)
    except (select.error, socket.error) as exc:
     if (getattr(exc, u'errno', None) not in SELECT_BAD_FD):
      raise
     readers.discard(fd)
     writers.discard(fd)
     err.discard(fd)
   return (set(), set(), 1)
  else:
   raise

def _select ( readers = None , writers = None , err = None , timeout = 0 , poll = _select_imp ) : readers = ( set ( ) if ( readers is None ) else readers ) writers = ( set ( ) if ( writers is None ) else writers ) err = ( set ( ) if ( err is None ) else err ) try : return poll ( readers , writers , err , timeout ) except ( select . error , socket . error ) as exc : if ( exc . errno == errno . EINTR ) : return ( set ( ) , set ( ) , 1 ) elif ( exc . errno in SELECT_BAD_FD ) : for fd in ( ( readers | writers ) | err ) : try : select . select ( [ fd ] , [ ] , [ ] , 0 ) except ( select . error , socket . error ) as exc : if ( getattr ( exc , u'errno' , None ) not in SELECT_BAD_FD ) : raise readers . discard ( fd ) writers . discard ( fd ) err . discard ( fd ) return ( set ( ) , set ( ) , 1 ) else : raise
select the kth smallest element in array[low:high + 1] .