def encode(self, udh):
        nonRepeatable = {}
        iEBytes = ''
        for iElement in udh:
            if not self.isIdentifierRepeatable(iElement.identifier):
                if iElement.identifier in nonRepeatable:
                    raise ValueError("Cannot repeat element %s" % str(iElement.identifier))
                for identifier in self.getIdentifierExclusionList(iElement.identifier):
                    if identifier in nonRepeatable:
                        raise ValueError("%s and %s are mutually exclusive elements" % (str(iElement.identifier), str(identifier)))
                nonRepeatable[iElement.identifier] = None
            iEBytes += self.iEEncoder.encode(iElement)   
        headerLen = len(iEBytes)
        return self.int8Encoder.encode(headerLen) + iEBytes

    #http://www.3gpp.org/ftp/Specs/archive/23_series/23.040/23040-100.zip
    #GSM spec says for non-repeatable and mutually exclusive elements that
    #get repeated we should use the last occurrance
dataset/ETHPy150Open jookies/jasmin/jasmin/vendor/smpp/pdu/gsm_encoding.py/UserDataHeaderEncoder.encode/original