def get_files(folder, restrict_to_folder=False):
    """
        Gets all files in a folder + subfolders
        :param folder: pathlib.Path object
        :param restrict_to_folder: bool. If false also
            the files in the subdirectories are found
    """
    if not restrict_to_folder:
        return [x for x in folder.glob("**/*") if x.is_file()]
    else:
        return [
            x
            for x in folder.glob("**/*")
            if x.is_file() and x.parent.name == folder.name
        ]