def cast_to_int(data):
    """
    Python 3+ has an unlimited-size integer representation
    We can convert any numpy integer type to Python int for serialising to JSON
    """
    if isinstance(data, list):
        return data
    else:
        return int(data)