MDL-35339, one could pass a custom list of course modules to print in the section. Example: I could print just a single activity in the section. This is handy for custom course formats.
Now, the $mods parameter is not used and all the code for printing an activity is trapped inside of print_section. The suggestion would be to move the rendering code of the single activity to a separate method (probably multiple methods, it's a lot of code, but one method to kick off default rendering) so it can be re-used outside of print_section.