code: def directory_exists(self, directory):
          
          file_list = []
          self.session.retrlines('LIST', file_list.append)
          return any(f.split()[-1] == directory and f.upper().startswith('D') for f in file_list)
docs: Check if directory exists (in current location)