def select(self, timeout=0):
    ''' Waits up to timeout seconds, but may return before then if I/O is
    ready. '''
    self._in_select += 1
    try:
      read_sockets, write_sockets, exception_sockets = self.grab_workers_rwe()
      rlist, wlist, elist = select.select(read_sockets, write_sockets, exception_sockets, timeout)
      self.handle_workers_rwe(rlist, wlist, elist)
    except select.error:
      # TODO(cs): this is a hack: file descriptor is closed upon shut
      # down, and select throws up.
      sys.stderr.write("File Descriptor Closed\n")
    except __HOLE__:
      # Same behavior, error message is:
      # TypeError: argument must be an int, or have a fileno() method.
      sys.stderr.write("File Descriptor Closed\n")
    finally:
      self._in_select -= 1
    if self._in_select == 0 and self._close_requested and not self.closed:
      self._do_close_all()
dataset/ETHPy150Open ucb-sts/sts/sts/util/io_master.py/IOMaster.select