Externalize output formatter to a dedicated function.

The dedicated function 'format_output(command, output)' can be
redefined by router and can be used to format the output according to
what is inside. In this way, the output can be formatted differently
according to the router type and the command.