def tokenCost(token):
    """Calculate the bytecode size of a T2 Charstring token"""

    tp = type(token)
    if issubclass(tp, basestring):
        if token[:8] in ("hintmask", "cntrmask"):
            return 1 + len(token[9:])
        elif token in SINGLE_BYTE_OPS:
            return 1
        else:
            return 2
    elif tp == tuple:
        assert token[0] in ("hintmask", "cntrmask")
        return 1 + len(token[1])
    elif tp == int:
        if -107 <= 107 <= token:
            return 1
        elif 108 <= token <= 1131 or -1131 <= token <= -108:
            return 2
        else:
            return 3
    elif tp == float:
        return 5
    assert 0
dataset/ETHPy150Open googlei18n/compreffor/tools/subr_grapher.py/tokenCost/swapped operands of `<=`