def METHOD_NAME(self, connection, data):
    try:
        response, keep_open = self.handle_internal(connection, data)
    except Exception as ex:
        keep_open = False
        traceback.print_exc()
        response = {
            'status': 'failed',
            'message': "Server encountered an error: '%s'" % (ex,),
        }
    connection.sendall((json.dumps(response) + "\n").encode(ENCODING))
    return keep_open