def download(self, localfile: str, remotefile: str, overwrite: bool = True, **kwargs):
logf     = '<STR_LIT>'<EOL>logn     = self._logcnt()<EOL>logcodei = "<STR_LIT>" + logn + "<STR_LIT:;>"<EOL>logcodeo = "<STR_LIT>" + logn<EOL>logcodeb = logcodeo.encode()<EOL>valid = self._sb.file_info(remotefile, quiet = True)<EOL>if valid is None:<EOL><INDENT>return {'<STR_LIT>' : False, <EOL>'<STR_LIT>'     : "<STR_LIT>"+str(remotefile)+"<STR_LIT>"}<EOL><DEDENT>if valid == {}:<EOL><INDENT>return {'<STR_LIT>' : False, <EOL>'<STR_LIT>'     : "<STR_LIT>"+str(remotefile)+"<STR_LIT>"}<EOL><DEDENT>if os.path.isdir(localfile):<EOL><INDENT>locf = localfile + os.sep + remotefile.rpartition(self._sb.hostsep)[<NUM_LIT:2>]<EOL><DEDENT>else:<EOL><INDENT>locf = localfile<EOL><DEDENT>try:<EOL><INDENT>fd = open(locf, '<STR_LIT:wb>')<EOL>fd.write(b'<STR_LIT>')<EOL>fd.close()<EOL>fd = open(locf, '<STR_LIT:wb>')<EOL><DEDENT>except OSError as e:<EOL><INDENT>return {'<STR_LIT>' : False, <EOL>'<STR_LIT>'     : "<STR_LIT>"+str(locf)+"<STR_LIT>"+str(e)}<EOL><DEDENT>code = "<STR_LIT>"+remotefile+"<STR_LIT>"<EOL>ll = self.submit(code, "<STR_LIT:text>")<EOL>logf  = ll['<STR_LIT>']<EOL>self.stdin[<NUM_LIT:0>].send(b'<STR_LIT>')<EOL>self.stdin[<NUM_LIT:0>].send(b'<STR_LIT:\n>'+logcodei.encode()+b'<STR_LIT:\n>'+b'<STR_LIT>'+logcodeb+b'<STR_LIT:\n>')<EOL>done  = False<EOL>datar = b'<STR_LIT>'<EOL>bail  = False<EOL>while not done:<EOL><INDENT>while True:<EOL><INDENT>if os.name == '<STR_LIT>':<EOL><INDENT>try:<EOL><INDENT>rc = self.pid.wait(<NUM_LIT:0>)<EOL>self.pid = None<EOL>self._sb.SASpid = None<EOL>return {'<STR_LIT>' : False, <EOL>'<STR_LIT>'     : "<STR_LIT>"+str(rc)}<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>else:<EOL><INDENT>rc = os.waitpid(self.pid, os.WNOHANG)<EOL>if rc[<NUM_LIT:1>]:<EOL><INDENT>self.pid = None<EOL>self._sb.SASpid = None<EOL>return {'<STR_LIT>' : False, <EOL>'<STR_LIT>'     : "<STR_LIT>"+str(rc)}<EOL><DEDENT><DEDENT>if bail:<EOL><INDENT>if datar.count(logcodeb) >= <NUM_LIT:1>:<EOL><INDENT>break<EOL><DEDENT><DEDENT>try:<EOL><INDENT>data = self.stdout[<NUM_LIT:0>].recv(<NUM_LIT>)<EOL><DEDENT>except (BlockingIOError):<EOL><INDENT>data = b'<STR_LIT>'<EOL><DEDENT>if len(data) > <NUM_LIT:0>:<EOL><INDENT>datar += data<EOL>if len(datar) > <NUM_LIT>:<EOL><INDENT>fd.write(datar[:<NUM_LIT>])<EOL>datar = datar[<NUM_LIT>:]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>sleep(<NUM_LIT:0.1>)<EOL>try:<EOL><INDENT>log = self.stderr[<NUM_LIT:0>].recv(<NUM_LIT>).decode(self.sascfg.encoding, errors='<STR_LIT:replace>')<EOL><DEDENT>except (BlockingIOError):<EOL><INDENT>log = b'<STR_LIT>'<EOL><DEDENT>if len(log) > <NUM_LIT:0>:<EOL><INDENT>logf += log<EOL>if logf.count(logcodeo) >= <NUM_LIT:1>:<EOL><INDENT>bail = True<EOL><DEDENT><DEDENT><DEDENT><DEDENT>done = True<EOL><DEDENT>fd.write(datar.rpartition(logcodeb)[<NUM_LIT:0>])<EOL>fd.flush()<EOL>fd.close()<EOL>self._log += logf<EOL>final = logf.partition(logcodei)<EOL>z = final[<NUM_LIT:0>].rpartition(chr(<NUM_LIT:10>))<EOL>prev = '<STR_LIT>' %  (self._log_cnt - <NUM_LIT:1>)<EOL>zz = z[<NUM_LIT:0>].rpartition("<STR_LIT>" + prev +'<STR_LIT:\n>')<EOL>logd = zz[<NUM_LIT:2>].replace("<STR_LIT>", '<STR_LIT>')<EOL>ll = self.submit("<STR_LIT>", '<STR_LIT:text>')<EOL>logd += ll['<STR_LIT>']<EOL>return {'<STR_LIT>' : True, <EOL>'<STR_LIT>'     : logd}<EOL>
This method downloads a remote file from the SAS servers file system.
localfile  - path to the local file to create or overwrite
remotefile - path to remote file tp dpwnload
overwrite  - overwrite the output file if it exists?