from typing import List
import pathlib


def get_image_paths(
    data_dir_path: str, species: List[str], file_ext: str = "JPG"
) -> List[str]:
    """ Get image file paths that match species and file extension """
    data_dir = pathlib.Path(data_dir_path)

    if "all" in species:
        return sorted(list(map(str, data_dir.glob(f"*/*.{file_ext}"))))

    image_paths = []
    for spec in species:
        paths = list(map(str, data_dir.glob(f"{spec}*/*.{file_ext}")))
        image_paths.extend(paths)
    return sorted(image_paths)