def get_all_sensors(filename: str, pattern: str | None = None) -> list[str]:
        """
        Get all sensors that exist in the given file.

        Parameters
        ----------
        filename: str
        pattern: str, optional
            Only return those sensor names that match the given pattern.

        Returns
        -------
        sensor_names: list of str
            Sensor names that match the pattern or all sensor names in the file.
        """
        with h5py.File(filename, "r") as h5file:
            clab_set = h5file["nfo"]["clab"][:].squeeze()
            all_sensor_names = [
                "".join(chr(c.item()) for c in h5file[obj_ref]) for obj_ref in clab_set
            ]
            if pattern is not None:
                all_sensor_names = list(
                    filter(lambda sname: re.search(pattern, sname), all_sensor_names)
                )
        return all_sensor_names

        Get all sensors that exist in the given file.

        Parameters
        ----------
        filename: str
        pattern: str, optional
            Only return those sensor names that match the given pattern.

        Returns
        -------
        sensor_names: list of str
            Sensor names that match the pattern or all sensor names in the file.
        
braindecode/datasets/bbci.py