def download(self, source_file, target_folder='<STR_LIT>'):
current_folder = self._ftp.pwd()<EOL>if not target_folder.startswith('<STR_LIT:/>'):  <EOL><INDENT>target_folder = join(getcwd(), target_folder)<EOL><DEDENT>folder = os.path.dirname(source_file)<EOL>self.cd(folder)<EOL>if folder.startswith("<STR_LIT:/>"):<EOL><INDENT>folder = folder[<NUM_LIT:1>:]<EOL><DEDENT>destination_folder = join(target_folder, folder)<EOL>if not os.path.exists(destination_folder):<EOL><INDENT>print("<STR_LIT>", destination_folder)<EOL>os.makedirs(destination_folder)<EOL><DEDENT>source_file = os.path.basename(source_file)<EOL>destination = join(destination_folder, source_file)<EOL>try:<EOL><INDENT>with open(destination, '<STR_LIT:wb>') as result:<EOL><INDENT>self._ftp.retrbinary('<STR_LIT>' % (source_file,),<EOL>result.write)<EOL><DEDENT><DEDENT>except error_perm as e:  <EOL><INDENT>print(e)<EOL>remove(join(target_folder, source_file))<EOL>raise<EOL><DEDENT>self._ftp.cwd(current_folder)<EOL>
Downloads a file from the FTP server to target folder

        :param source_file: the absolute path for the file on the server
                   it can be the one of the files coming from
                   FtpHandler.dir().
        :type source_file: string
        :param target_folder: relative or absolute path of the
                              destination folder default is the
                              working directory.
        :type target_folder: string