def __get_ftp_session_id_(self):
        """ Returns an unsued FTP session from the pool
        """
        wait_time = 0
        while True:
            for i in range(self.number_of_connections):
                if self.ftp_pool_lock[i].locked() == False:
                    self.ftp_pool_lock[i].acquire()
                    logger.debug("Request for ftp session got session #" + str(i) )
                    return i
            time.sleep(3)
            wait_time = wait_time + 3
            if wait_time < self.wait_for_connnection_time:
               logger.debug("No ftp sessions available..re-checking after wait..." )
               continue
            else:
               raise NameError, "TimeOut for FTP"
 Returns an unsued FTP session from the pool
        
recipes/Python/302592_Threaded_FTP_Client/recipe-302592.py