def share_mask(mask):
    """Flag a chan,integration if any pol/baseline has flagged it."""
    m = {}
    for pol in mask:
        for bl in mask[pol]:
            for t in mask[pol][bl]:
                m[t] = m.get(t, 0) | mask[pol][bl]
    for pol in mask:
        for bl in mask[pol]:
            for t in mask[pol][bl]:
                mask[pol][bl][t] = m[t]
    return mask
