@staticmethod
def _str_to_num(s):
    """Convert a string to either an `int` or a `float`.
        Troublingly, the API likes values like "18", without a trailing
        ".0", for whole numbers. So we use `int`s for integers and
        `float`s for non-whole numbers.
        """
    f = float(s)
    if f == int(f):
        return int(f)
    else:
        return f
