def _scandir_generator(is_bytes, scandir_path, system):
    """
    scandir generator

    Args:
        is_bytes (bool): True if DirEntry must handle path as bytes.
        scandir_path (str): Path.
        system (pycosio._core.io_system.SystemBase subclass):
            Storage system.

    Yields:
        DirEntry: Directory entries
    """
    with handle_os_exceptions():
        for name, header in system.list_objects(scandir_path, first_level=True):
            yield DirEntry(
                scandir_path=scandir_path, system=system, name=name,
                header=header, bytes_path=is_bytes)