Set a int parameter if applicable.

    :param dict params: A dict containing API call parameters.

    :param str name: The name of the parameter to set.

    :param int value:
        The value of the parameter. If ``None``, the field will not be set. If
        an instance of a numeric type or a string that can be turned into a
        ``int``, the relevant field will be set. Any other value will raise a
        `ValueError`.

    :param int min:
        If provided, values less than this will raise ``ValueError``.

    :param int max:
        If provided, values greater than this will raise ``ValueError``.

    :returns: ``None``

def set_int_param(params, name, value, min=None, max=None):
    """
    Set a int parameter if applicable.

    :param dict params: A dict containing API call parameters.

    :param str name: The name of the parameter to set.

    :param int value:
        The value of the parameter. If ``None``, the field will not be set. If
        an instance of a numeric type or a string that can be turned into a
        ``int``, the relevant field will be set. Any other value will raise a
        `ValueError`.

    :param int min:
        If provided, values less than this will raise ``ValueError``.

    :param int max:
        If provided, values greater than this will raise ``ValueError``.

    :returns: ``None``
    """
    if value is None:
        return

    try:
        value = int(str(value))
    except:
        raise ValueError(
            "Parameter '%s' must be an integer (or a string representation of"
            " an integer) or None, got %r." % (name, value))
    if min is not None and value < min:
        raise ValueError(
            "Parameter '%s' must not be less than %r, got %r." % (
                name, min, value))
    if max is not None and value > max:
        raise ValueError(
            "Parameter '%s' must not be greater than %r, got %r." % (
                name, min, value))

    params[name] = str(value)