def get_domain_max(d):
    """ Retrieves the upper bound of an integer or interval variable domain.

    The domain can be either:

     * a single number value,
     * a list of numbers, or tuple of 2 numbers representing an interval.

    This method returns the last number of the domain.

    Args:
        d: Domain
    Returns:
        Domain upper bound
    """
    if isinstance(d, (tuple, list)):
        d = d[-1]
        if isinstance(d, (tuple, list)):
            d = d[-1]
    return d