self.sftp.next() is not supported by python 3, self.sftp.__next__() is also possible, but next(self.sftp) is the prefered syntax for a generator object in python 3