def encodeBody(self, pdu):
        body = ''

        #Some PDU responses have no defined body when the status is not 0
        #    c.f. 4.1.2. "BIND_TRANSMITTER_RESP"
        #    c.f. 4.1.4. "BIND_RECEIVER_RESP"
        #    c.f. 4.4.2. SMPP PDU Definition "SUBMIT_SM_RESP"
        if pdu.commandId in (CommandId.bind_receiver_resp, CommandId.bind_transmitter_resp, CommandId.bind_transceiver_resp, CommandId.submit_sm_resp):
            if pdu.status != pdu_types.CommandStatus.ESME_ROK and pdu.noBodyOnError:
                return body

        for paramName in pdu.mandatoryParams:
            if paramName not in pdu.params:
                raise ValueError("Missing required parameter: %s" % paramName)

        body += self.encodeRequiredParams(pdu.mandatoryParams, self.getRequiredParamEncoders(pdu), pdu.params)
        body += self.encodeOptionalParams(pdu.optionalParams, pdu.params)
        return body
dataset/ETHPy150Open jookies/jasmin/jasmin/vendor/smpp/pdu/pdu_encoding.py/PDUEncoder.encodeBody/original