How does gas cool in DM halos?