def get_new_filename(filename: str) ->str:
    """get_new_filename is system agnostic (3A, 3B1, 3B2).
    Gets an alyx compatible filename from any spikeglx ephys file.

    :param filename: Name of an ephys file
    :type filename: str
    :return: New name for ephys file
    :rtype: str
    """
    root = '_spikeglx_ephysData'
    gt = None
    for g in range(10):
        for t in range(10):
            if f'_g{g}_t{t}' in filename:
                gt = f'_g{g}_t{t}'
    else:
        if gt is None:
            raise NotImplementedError
    if '.bin' in filename:
        ext = 'bin'
    elif '.meta' in filename:
        ext = 'meta'
    if '.nidq.' in filename:
        return '.'.join([root + gt, 'nidq', ext])
    if '.imec0.' in filename:
        probe = 'imec0'
    elif '.imec1.' in filename:
        probe = 'imec1'
    elif '.imec.' in filename:
        probe = 'imec'
    if '.ap.' in filename:
        freq = 'ap'
    elif '.lf.' in filename:
        freq = 'lf'
    return '.'.join([root + gt, probe, freq, ext])
