A common real battery is often modelled (to a good approximation) as a perfect voltage source having emf $\varepsilon$ with a series internal resistance $r$. So, when a current $I$ is drained from it, the voltage across the terminals is $\varepsilon - I r$.
Now, does it follow that necessarily the power dissipated as heat equals $I^2 r$? If so, is the internal resistance due to some actual component within a battery?
(This would certainly be the case if the chemical processes inside the battery actually generated an emf $\varepsilon$ and something inside actually worked as a resistance. However, it need not be true if for some reason the "actual" emf is actually current-dependent and so there wouldn't be an exact $I r$ voltage drop across any part of the battery as to dissipate $I^2r$ power.)