def validate_cpu(self, value):
        for k, v in value.viewitems():
            if v is None:  # use NoneType to unset a value
                continue
            if not re.match(PROCTYPE_MATCH, k):
                raise serializers.ValidationError("Process types can only contain [a-z]")
            shares = re.match(CPUSHARE_MATCH, str(v))
            if not shares:
                raise serializers.ValidationError("CPU shares must be an integer")
            for v in shares.groupdict().viewvalues():
                try:
                    i = int(v)
                except __HOLE__:
                    raise serializers.ValidationError("CPU shares must be an integer")
                if i > 1024 or i < 0:
                    raise serializers.ValidationError("CPU shares must be between 0 and 1024")
        return value
dataset/ETHPy150Open deis/deis/controller/api/serializers.py/ConfigSerializer.validate_cpu