from pathlib import Path
import shutil


def images_path(tmp_path_factory, some_image, n_images: int = 3) -> Path:
    """
    Return a temporary directory that has been prepared with some image files:
    - img_0.jpg
    - img_1.jpg
    - img_2.jpg
    - ...
    """
    tmp_img_path = tmp_path_factory.mktemp('imgs_dir')
    for i in range(n_images):
        output_path = tmp_img_path.joinpath(f'sub_dir/img_{i}.jpg')
        output_path.parent.mkdir(parents=True, exist_ok=True)
        some_image.seek(0)
        with open(str(output_path), 'wb') as f:
            shutil.copyfileobj(fsrc=some_image, fdst=f)
    return tmp_img_path