def find_index_file(self, filename=None, extensions=('.html', '.htm'), stop_names=('index', ), raise_if_not_found=True):

        if filename:
            if self[filename]:
                return filename
            else:
                raise FileNotFound(filename)

        found_files = []

        for filename in self.list_files():

            bn = os.path.basename(filename)
            if bn.startswith('.'):
                # ignore hidden files
                continue
            name, ext = os.path.splitext(bn)

            if ext in extensions:
                if stop_names and name in stop_names:
                    return filename
                found_files.append(filename)

        # Return first found file
        if found_files:
            return found_files[0]
        elif raise_if_not_found:
            raise FileNotFound('index %s' % "|".join(extensions))
dataset/ETHPy150Open lavr/python-emails/emails/loader/local_store.py/BaseLoader.find_index_file/original