def read_file(self, filename, destination='<STR_LIT>'):
if not destination:<EOL><INDENT>destination = filename<EOL><DEDENT>log.info('<STR_LIT>', filename, destination)<EOL>data = self.download_file(filename)<EOL>log.info(destination)<EOL>if not os.path.exists(os.path.dirname(destination)):<EOL><INDENT>try:<EOL><INDENT>os.makedirs(os.path.dirname(destination))<EOL><DEDENT>except OSError as e:  <EOL><INDENT>if e.errno != errno.EEXIST:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>with open(destination, '<STR_LIT:w>') as fil:<EOL><INDENT>fil.write(data)<EOL><DEDENT>
reading data from device into local file