'Stop recording S3Log messages (and return the messages)'

def stop(self):

    handler = self.handler
    if (handler is not None):
        logger = logging.getLogger(__name__)
        logger.removeHandler(handler)
        handler.close()
        self.handler = None
    strbuf = self.strbuf
    if (strbuf is not None):
        return strbuf.getvalue()
    else:
        return ''
