code: def _os_walk(directory, recurse=True, **kwargs):
      
      if recurse:
          for root, dirs, files in os.walk(directory, **kwargs):
              yield root, dirs, files
      else:
          files = []
          for filename in os.listdir(directory):
              if os.path.isfile(os.path.join(directory, filename)):
                  files.append(filename)
          yield directory, [], files
docs: Work like os.walk but if recurse is False just list current directory