Cost of debt with multiple bonds/borrowings?

Hi all, if there’s a company that happen to have both a loan from bank (say 5% p.a) + bonds issuance (say YTM 7%), how do we compute the cost of debt?

I was thinking to take a weighted average of the two?

That’s exactly what it is done normally. Regards, Oscar