code: def list_all_directories(self):
          
          def list_dirs_recursively(directory):
              if directory == self.filesystem:
                  yield directory
              d_gen = itertools.chain(
                  directory.directories,
                  *tuple(list_dirs_recursively(d)
                         for d in directory.directories))
              for d in d_gen:
                  yield d
          return list_dirs_recursively(self.filesystem)
docs: Utility method that yields all directories on the device's file
              systems.