def get_files(dir, exts, exclude=None, recursive=False):
    """
    Get a list of files within a directory with given extensions.
    Exclude/black list directories from the list if specified. By default,
    the search is recursive, looking in all subdirectories of 'dir'

    :param dir: String root directory to search under. All subdirectories are
        also searched by default
    :param exts: List of string file extensions. Files inside of dir with
        names ending with this string will be included in the list. Note: the
        string does not strictly need to be a file extension (beginging with
        a '.' dot), it could be the entire name of the file, or a common
        suffix to files.
    :param exclude: List of strings specifying directories that should not be
        included in the output list
    :param recursive: When True, search in all subdirectories, otherwise just
        look in the current directory
    :return: List of string directories
    """
    file_paths =[]
    if recursive:
        for root, _, _ in os.walk(dir):
            # os.walk() does not add path separator by default to end of path
            root = add_suffix(root, get_path_separator())
            if exclude is not None and is_dir_inside(root, exclude):
                # Skip directories that are in the exclude list
                continue
            file_paths.extend(get_files_in_dir(root, *exts))
    else:
        file_paths.extend(get_files_in_dir(dir, *exts))
    return file_paths
Get a list of files within a directory with given extensions.
    Exclude/black list directories from the list if specified. By default,
    the search is recursive, looking in all subdirectories of 'dir'

    :param dir: String root directory to search under. All subdirectories are
        also searched by default
    :param exts: List of string file extensions. Files inside of dir with
        names ending with this string will be included in the list. Note: the
        string does not strictly need to be a file extension (beginging with
        a '.' dot), it could be the entire name of the file, or a common
        suffix to files.
    :param exclude: List of strings specifying directories that should not be
        included in the output list
    :param recursive: When True, search in all subdirectories, otherwise just
        look in the current directory
    :return: List of string directories