def parseMessage(s):
    msgstart = s.find('(')
    msgid = int(s[:msgstart])
    try:
        return msgid_map[msgid].parseString(s[msgstart:])[0]
    except KeyError:
        raise pp.ParseException('Unknown Message ID: %s' % msgid)
def parseMessage(s):
    msgstart = s.find('(')
    msgid = int(s[:msgstart])
    if msgid == 500:
        return p_MembershipChangedMessage.parseString(s[msgstart:])[0]
    elif msgid == 0:
        return p_DebugMessage.parseString(s[msgstart:])[0]
    elif msgid == 1:
        return p_DebugLevelMessage.parseString(s[msgstart:])[0]
    elif msgid == 2:
        return p_MotorMessage.parseString(s[msgstart:])[0]
    elif msgid == 60:
        return p_BearingAutopilotEnabledMessage.parseString(s[msgstart:])[0]
    elif msgid == 70:
        return p_BearingAutopilotParamsMessage.parseString(s[msgstart:])[0]
    elif msgid == 61:
        return p_DepthAutopilotEnabledMessage.parseString(s[msgstart:])[0]
    elif msgid == 71:
        return p_DepthAutopilotParamsMessage.parseString(s[msgstart:])[0]
    elif msgid == 80:
        return p_DepthCalibrationMessage.parseString(s[msgstart:])[0]
    elif msgid == 62:
        return p_PitchAutopilotEnabledMessage.parseString(s[msgstart:])[0]
    elif msgid == 72:
        return p_PitchAutopilotParamsMessage.parseString(s[msgstart:])[0]
    elif msgid == 82:
        return p_StateRequestMessage.parseString(s[msgstart:])[0]
    elif msgid == 102:
        return p_ScriptMessage.parseString(s[msgstart:])[0]
    elif msgid == 83:
        return p_MotorRampRateMessage.parseString(s[msgstart:])[0]
    elif msgid == 84:
        return p_SetMotorMapMessage.parseString(s[msgstart:])[0]
    elif msgid == 85:
        return p_ResetMCBMessage.parseString(s[msgstart:])[0]
    elif msgid == 90:
        return p_CalibrateNoRotationMessage.parseString(s[msgstart:])[0]
    elif msgid == 81:
        return p_StateMessage.parseString(s[msgstart:])[0]
    elif msgid == 3:
        return p_TelemetryMessage.parseString(s[msgstart:])[0]
    elif msgid == 86:
        return p_BatteryUseMessage.parseString(s[msgstart:])[0]
    elif msgid == 87:
        return p_ProcessStatusMessage.parseString(s[msgstart:])[0]
    elif msgid == 88:
        return p_LocationMessage.parseString(s[msgstart:])[0]
    elif msgid == 89:
        return p_GPSLocationMessage.parseString(s[msgstart:])[0]
    elif msgid == 91:
        return p_SonarLocationMessage.parseString(s[msgstart:])[0]
    elif msgid == 4:
        return p_ImageMessage.parseString(s[msgstart:])[0]
    elif msgid == 30:
        return p_SonarDataMessage.parseString(s[msgstart:])[0]
    elif msgid == 31:
        return p_SonarImageMessage.parseString(s[msgstart:])[0]
    elif msgid == 332:
        return p_SpeedOfSoundMessage.parseString(s[msgstart:])[0]
    elif msgid == 333:
        return p_GeminiStatusMessage.parseString(s[msgstart:])[0]
    elif msgid == 32:
        return p_SonarControlMessage.parseString(s[msgstart:])[0]
    elif msgid == 33:
        return p_GeminiControlMessage.parseString(s[msgstart:])[0]
    elif msgid == 5:
        return p_AddNodeMessage.parseString(s[msgstart:])[0]
    elif msgid == 6:
        return p_RemoveNodeMessage.parseString(s[msgstart:])[0]
    elif msgid == 7:
        return p_ClearPipelineMessage.parseString(s[msgstart:])[0]
    elif msgid == 8:
        return p_SetNodeParameterMessage.parseString(s[msgstart:])[0]
    elif msgid == 9:
        return p_AddArcMessage.parseString(s[msgstart:])[0]
    elif msgid == 14:
        return p_RemoveArcMessage.parseString(s[msgstart:])[0]
    elif msgid == 10:
        return p_GraphRequestMessage.parseString(s[msgstart:])[0]
    elif msgid == 11:
        return p_ForceExecRequestMessage.parseString(s[msgstart:])[0]
    elif msgid == 12:
        return p_PipelineDiscoveryRequestMessage.parseString(s[msgstart:])[0]
    elif msgid == 13:
        return p_PipelineDiscoveryResponseMessage.parseString(s[msgstart:])[0]
    elif msgid == 130:
        return p_LinesMessage.parseString(s[msgstart:])[0]
    elif msgid == 131:
        return p_CirclesMessage.parseString(s[msgstart:])[0]
    elif msgid == 132:
        return p_CornersMessage.parseString(s[msgstart:])[0]
    elif msgid == 135:
        return p_KeyPointsMessage.parseString(s[msgstart:])[0]
    elif msgid == 133:
        return p_HistogramMessage.parseString(s[msgstart:])[0]
    elif msgid == 134:
        return p_CentreMessage.parseString(s[msgstart:])[0]
    elif msgid == 100:
        return p_ControllerStateMessage.parseString(s[msgstart:])[0]
    elif msgid == 101:
        return p_MotorStateMessage.parseString(s[msgstart:])[0]
    elif msgid == 103:
        return p_ScriptResponseMessage.parseString(s[msgstart:])[0]
    elif msgid == 104:
        return p_GraphableMessage.parseString(s[msgstart:])[0]
    elif msgid == 115:
        return p_NodeAddedMessage.parseString(s[msgstart:])[0]
    elif msgid == 116:
        return p_NodeRemovedMessage.parseString(s[msgstart:])[0]
    elif msgid == 117:
        return p_NodeParametersMessage.parseString(s[msgstart:])[0]
    elif msgid == 118:
        return p_GraphDescriptionMessage.parseString(s[msgstart:])[0]
    elif msgid == 119:
        return p_ArcAddedMessage.parseString(s[msgstart:])[0]
    elif msgid == 120:
        return p_ArcRemovedMessage.parseString(s[msgstart:])[0]
    elif msgid == 121:
        return p_StatusMessage.parseString(s[msgstart:])[0]
    elif msgid == 122:
        return p_InputStatusMessage.parseString(s[msgstart:])[0]
    elif msgid == 123:
        return p_OutputStatusMessage.parseString(s[msgstart:])[0]
    elif msgid == 124:
        return p_GuiImageMessage.parseString(s[msgstart:])[0]
    elif msgid == 40:
        return p_AliveMessage.parseString(s[msgstart:])[0]
    elif msgid == 50:
        return p_PressureMessage.parseString(s[msgstart:])[0]
    elif msgid == 200:
        return p_AIMessage.parseString(s[msgstart:])[0]
    elif msgid == 201:
        return p_AIlogMessage.parseString(s[msgstart:])[0]
    elif msgid == 150:
        return p_LightControlMessage.parseString(s[msgstart:])[0]
    elif msgid == 151:
        return p_CuttingDeviceMessage.parseString(s[msgstart:])[0]
    elif msgid == 152:
        return p_RedHerringBatteryStatusMessage.parseString(s[msgstart:])[0]
    elif msgid == 800:
        return p_SimPositionMessage.parseString(s[msgstart:])[0]
    else:
        raise pp.ParseException('Unknown Message ID: %s' % msgid)