from pathlib import Path


def _get_files_from_dir(directory, file_format):
    """
    Returns the list of file paths with the given format contained in the given directory and its subdirectories.

    :param directory: Path to the root directory.
    :type directory: str
    :param file_format: Format of the files to retrieve, specified as '*.format'. It can specify any pattern that
        matches the desired files as long as it is compatible with Path().rglob().
    :type file_format: str
    :return: A list with the paths to all the files found in 'dir' with format 'file_format'.
    :rtype: list[Path]
    """
    return list(Path(directory).rglob(file_format))