import clr
clr.AddReference('Soti.Connect.SemanticEngine.Conversions')

from Soti.Connect.SemanticEngine.Conversions import Converter

print("Loading GeneralToCitizenCLSpeed Converter")

class GeneralToCitizenCLSpeed(Converter):
    def Execute(self, args):
        res = "2 IPS"
        speed = float(args[0])

        if (speed <= 50.8):
            res = "2 IPS"
        elif (speed <= 76.2):
            res = "3 IPS"
        elif (speed <= 101.6):
            res = "4 IPS"
        elif (speed <= 127):
            res = "5 IPS"
        elif (speed <= 152.4):
            res = "6 IPS"
        elif (speed <= 177.8):
            res = "7 IPS"
        elif (speed <= 203.2):
            res = "8 IPS"
        elif (speed <= 228.6):
            res = "9 IPS"
        elif (speed >= 254):
            res = "10 IPS"
        else:
            res = "2 IPS"


        return res




plugin = GeneralToCitizenCLSpeed("GeneralToCitizenCLSpeed")

store.AddConverter(plugin)