<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cross_chan_coherence(st1, st2, allow_shift=False, shift_len=0.2, i=0, xcorr_func='time_domain'):
 """ Calculate cross-channel coherency. Determine the cross-channel coherency between two streams of multichannel seismic data. :type st1: obspy.core.stream.Stream :param st1: Stream one :type st2: obspy.core.stream.Stream :param st2: Stream two :type allow_shift: bool :param allow_shift: Whether to allow the optimum alignment to be found for coherence, defaults to `False` for strict coherence :type shift_len: float :param shift_len: Seconds to shift, only used if `allow_shift=True` :type i: int :param i: index used for parallel async processing, returned unaltered :type xcorr_func: str, callable :param xcorr_func: The method for performing correlations. Accepts either a string or callabe. See :func:`eqcorrscan.utils.correlate.register_array_xcorr` for more details :returns: cross channel coherence, float - normalized by number of channels, and i, where i is int, as input. :rtype: tuple """

    cccoh = 0.0
    kchan = 0
    array_xcorr = get_array_xcorr(xcorr_func)
    for tr in st1:
        tr2 = st2.select(station=tr.stats.station,
                         channel=tr.stats.channel)
        if len(tr2) > 0 and tr.stats.sampling_rate != \
                tr2[0].stats.sampling_rate:
            warnings.warn('Sampling rates do not match, not using: %s.%s'
                          % (tr.stats.station, tr.stats.channel))
        if len(tr2) > 0 and allow_shift:
            index, corval = xcorr(tr, tr2[0],
                                  int(shift_len * tr.stats.sampling_rate))
            cccoh += corval
            kchan += 1
        elif len(tr2) > 0:
            min_len = min(len(tr.data), len(tr2[0].data))
            cccoh += array_xcorr(
                np.array([tr.data[0:min_len]]), tr2[0].data[0:min_len],
                [0])[0][0][0]
            kchan += 1
    if kchan:
        cccoh /= kchan
        return np.round(cccoh, 6), i
    else:
        warnings.warn('No matching channels')
        return 0, i