def get_isobaric_ratios(psmfn, psmheader, channels, denom_channels, min_int,
                        targetfn, accessioncol, normalize, normratiofn):
    psm_or_feat_ratios = get_psmratios(psmfn, psmheader, channels,
                                       denom_channels, min_int, accessioncol)
    if normalize and normratiofn:
        normheader = reader.get_tsv_header(normratiofn)
        normratios = get_ratios_from_fn(normratiofn, normheader, channels)
        ch_medians = get_medians(channels, normratios, report=True)
        outratios = calculate_normalized_ratios(psm_or_feat_ratios, ch_medians,
                                                channels)
    elif normalize:
        flatratios = [[feat[ch] for ch in channels]
                      for feat in psm_or_feat_ratios]
        ch_medians = get_medians(channels, flatratios, report=True)
        outratios = calculate_normalized_ratios(psm_or_feat_ratios, ch_medians,
                                                channels)
    else:
        outratios = psm_or_feat_ratios
    if accessioncol and targetfn:
        outratios = {x[ISOQUANTRATIO_FEAT_ACC]: x for x in outratios}
        return output_to_target_accession_table(targetfn, outratios, channels)
    elif not accessioncol and not targetfn:
        return paste_to_psmtable(psmfn, psmheader, outratios)
    elif accessioncol and not targetfn:
        return ({(k if not k == ISOQUANTRATIO_FEAT_ACC
                  else prottabledata.HEADER_ACCESSION): v
                 for k, v in ratio.items()} for ratio in outratios)