def _encode(self, esmClass):
        modeName = str(esmClass.mode)
        typeName = str(esmClass.type)
        gsmFeatureNames = [str(f) for f in esmClass.gsmFeatures]

        if modeName not in constants.esm_class_mode_name_map:
            raise ValueError("Unknown esm_class mode name %s" % modeName)
        if typeName not in constants.esm_class_type_name_map:
            raise ValueError("Unknown esm_class type name %s" % typeName)
        for featureName in gsmFeatureNames:
            if featureName not in constants.esm_class_gsm_features_name_map:
                raise ValueError("Unknown esm_class GSM feature name %s" % featureName)

        modeVal = constants.esm_class_mode_name_map[modeName]
        typeVal = constants.esm_class_type_name_map[typeName]
        gsmFeatureVals = [constants.esm_class_gsm_features_name_map[fName] for fName in gsmFeatureNames]

        intVal = modeVal | typeVal
        for fVal in gsmFeatureVals:
            intVal |= fVal

        return Int1Encoder().encode(intVal)
dataset/ETHPy150Open jookies/jasmin/jasmin/vendor/smpp/pdu/pdu_encoding.py/EsmClassEncoder._encode/original