def _retreive_file_lines(self, filename_format, station, year):
        string = BytesIO()

        if self.ftp is None:
            self.ftp = self._get_ftp_connection()

        for station_id in self._get_potential_station_ids(station):
            filename = filename_format.format(station=station_id, year=year)
            try:
                self.ftp.retrbinary('RETR {}'.format(filename), string.write)
                break
            except (IOError, ftplib.error_perm):
                pass
            except (ftplib.error_temp, EOFError): # Bad connection. attempt to reconnect.
                self.ftp.close()
                self.ftp = self._get_ftp_connection()
                try:
                    self.ftp.retrbinary('RETR {}'.format(filename), string.write)
                    break
                except (IOError, ftplib.error_perm):
                    pass

        string.seek(0)
        f = gzip.GzipFile(fileobj=string)
        lines = f.readlines()
        string.close()
        return lines
dataset/ETHPy150Open impactlab/eemeter/eemeter/weather.py/NOAAClient._retreive_file_lines/original