def _construct_bids_filename(base, ext, part_idx):
    """Construct a BIDS compatible filename for split files."""
    deconstructed_base = base.split('_')
    bids_supported = ['meg', 'eeg', 'ieeg']
    for mod in bids_supported:
        if mod in deconstructed_base:
            idx = deconstructed_base.index(mod)
            modality = deconstructed_base.pop(idx)
    base = '_'.join(deconstructed_base)
    use_fname = '%s_part-%02d_%s%s' % (base, part_idx, modality, ext)
    return use_fname
