def _prepare_io_handler(self, handler):
logger.debug("<STR_LIT>".format(handler))<EOL>ret = handler.prepare()<EOL>logger.debug("<STR_LIT>".format(ret))<EOL>if isinstance(ret, HandlerReady):<EOL><INDENT>del self._unprepared_handlers[handler]<EOL>prepared = True<EOL><DEDENT>elif isinstance(ret, PrepareAgain):<EOL><INDENT>if ret.timeout is not None:<EOL><INDENT>if self._timeout is not None:<EOL><INDENT>self._timeout = min(self._timeout, ret.timeout)<EOL><DEDENT>else:<EOL><INDENT>self._timeout = ret.timeout<EOL><DEDENT><DEDENT>prepared = False<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>")<EOL><DEDENT>return prepared<EOL>
Call the `interfaces.IOHandler.prepare` method and
        remove the handler from unprepared handler list when done.