def METHOD_NAME(path, result_files, file_types, ignore_files,
                 check_dirs=None):
    """
    Returns a list of matching file entries and directories as specified.
    :param path: File path to search in.
    :param result_files: List to collect all result file paths in.
    :param file_types: List of file types to check for.
    :param ignore_files: List of files to ignore.
    :param check_dirs: List of directories to check. If empty, all directories
        will be checked.
    :return: A lists containing sub-directories.
    """
    entries = os.listdir(path)
    sub_dirs = []
    for item in entries:
        item_path = os.path.normpath(os.path.join(path, item))
        if os.path.isfile(item_path):
            if (item.split('.')[-1] in file_types
                and item_path not in ignore_files):
                result_files.append(item_path)
        elif os.path.isdir(item_path):
            if path == '.' and check_dirs and item not in check_dirs:
                continue
            sub_dirs.append(item_path)
    return sub_dirs