def recur_get(ftp, ftp_loc, local_loc, module_id, config, ftp_pool):
    """ Function: Recursive function to get everything under the remote location ftp_loc 
    	and transfer these to the local location local_loc for module module_id
    	ftp_loc is the absolute location on the remove server however local_loc is the
    	absolute location on the local machine where the files/directories are to be created
    """ 
    local_ftp_loc = ftp_loc
    logger.debug( "Parameters for  recur_get ftp_loc: " + local_ftp_loc  )
    logger.debug( "Parameters for  recur_get local_loc: " + local_loc  )
    logger.debug( "FTP' CDing to location: " + local_ftp_loc  )
    ftp.cwd("/")		
    ftp.cwd(local_ftp_loc)
    for file in ftp.nlst():
        if file == "." or file == "..":
            continue
        try:
            logger.debug( "current position is " + ftp.pwd())
            logger.debug( "Taking up position at " + local_ftp_loc)
            ftp.cwd("/") 
            ftp.cwd(local_ftp_loc) 	
            logger.debug("Try CDing to directory :" + file  + "from" + local_ftp_loc)
            ftp.cwd(file)
            ftp.cwd('..')
            # A rather weired method to see if a file or directory exists on the remote server
            # Since unix and windows has different conventions for directory name, this is the only
            # platform independent method I could think of, suggestions welcome
            logger.debug( "Success, this is a directory: " + file  )
            stage_location_tmp =  os.path.join(local_loc, file)
            logger.debug( "Creating a local folder : " + stage_location_tmp  )
            try:
               os.makedirs(stage_location_tmp)
            except:
               logger.debug( "Already Exists: " + file + " [" + str(sys.exc_info()[1])+ "]"  )
            #The local_ftp_loc string is saved so that it does not get corrupted
            #when the function gets into the recursive loop
            str_for_ftp = local_ftp_loc
            recur_get(ftp, str_for_ftp + "/" + file , os.path.join(local_loc, file), module_id, config, ftp_pool)
            #original position of the ftp object is restored here
            ftp.cwd("/") 
            ftp.cwd(local_ftp_loc)              
        except ftplib.error_perm :
                logger.info( "File: " + file )
                logger.debug("[" + str(sys.exc_info()[1])+ "]")
                localfile = os.path.join(local_loc, file)
            	try:
                    ftp_pool.asynchronous_ftp_get( local_ftp_loc + "/" + file,localfile)
                except:
                    logger.error("Error reading from remote machine")
                    logger.error("Error:" + str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1]))
                    raise                   
        except:	
            logger.info( "Other error " + file + " " + " [" + str(sys.exc_info()[1])+ "]"  )
            raise
 Function: Recursive function to get everything under the remote location ftp_loc 
    	and transfer these to the local location local_loc for module module_id
    	ftp_loc is the absolute location on the remove server however local_loc is the
    	absolute location on the local machine where the files/directories are to be created
    
recipes/Python/302592_Threaded_FTP_Client/recipe-302592.py