    def validate(self, obj, value):
        """
        Validate that the passed in value is a valid memory specification

        It could either be a pure int, when it is taken as a byte value.
        If it has one of the suffixes, it is converted into the appropriate
        pure byte value.
        """
        if isinstance(value, (int, float)):
            return int(value)

        try:
            num = float(value[:-1])
        except ValueError:
            raise TraitError(
                f'{value} is not a valid memory specification. Must be an int or a string with suffix K, M, G, T'
            )
        suffix = value[-1]
        if suffix not in self.UNIT_SUFFIXES:
            raise TraitError(
                f'{value} is not a valid memory specification. Must be an int or a string with suffix K, M, G, T'
            )
        else:
            return int(float(num) * self.UNIT_SUFFIXES[suffix])
Validate that the passed in value is a valid memory specification

It could either be a pure int, when it is taken as a byte value.
If it has one of the suffixes, it is converted into the appropriate
pure byte value.
jupyterhub/traitlets.py