def METHOD_NAME(self, command, output):
    fullname = self._construct_filename(command)
    if isinstance(self, MonitorDumper):
        with open(fullname, 'w') as json_file:
            json.dump(output, json_file, indent=4)
    else:
        with open(fullname, 'w') as dump_file:
            dump_file.write(output)