def pairwise_tdoa(pw_cc, tdoa_func, fs=None):
    """Estimation TDOA between all channel pairs.

    The TDOA is estimated by finding the peak of cross-correlation summed
    across time.
    
    Args:
        pw_cc     : pairwise cross correlation
        tdoa_func : tdoa estimation function.
        fs        : sample rate (after upsampling),
                    if None (default) the result is number of samples.

    Returns:
        pw_tdoa   : TDOA between all channel pairs.
                    dict : (channel id, channel id) -> tdoa estimate.
    """
    return {k: tdoa_func(cc, fs) for k, cc in pw_cc.iteritems()}