exit when using internal function to add results
        automatically generates output, but each parameter can be overriden

        all parameters are optional

        arguments:
            code: exit status code
            message: a short, one-line message to display
            perfdata: perfdata, if any
            extdata: multi-line message to give more details

def finish(self, code=None, message=None, perfdata=None, extdata=None):
        """
        exit when using internal function to add results
        automatically generates output, but each parameter can be overriden

        all parameters are optional

        arguments:
            code: exit status code
            message: a short, one-line message to display
            perfdata: perfdata, if any
            extdata: multi-line message to give more details
        """
        if code is None:
            code = self.get_code()
        if message is None:
            message = self.get_message(msglevels=[code])
        if perfdata is None:
            perfdata = self.get_perfdata()
        if extdata is None:
            extdata = self.get_extdata()
        self.exit(code=code, message=message,
                  perfdata=perfdata, extdata=extdata)