def int_to_rgb(rgb_int):
    """
    Given an integer, converts to to RGB value. Any integer outside
    the range of (0, 16777215) will raise an invalid
    >>> int_to_rgb(-1)
    Traceback (most recent call last):
    ...
    ValueError: Integer must be in range [0, 16777215], got -1.
    >>> int_to_rgb(0)
    (0, 0, 0)
    >>> int_to_rgb(255)
    (0, 0, 255)
    >>> int_to_rgb(65280)
    (0, 255, 0)
    >>> int_to_rgb(16711680)
    (255, 0, 0)
    >>> int_to_rgb(16777215)
    (255, 255, 255)
    >>> int_to_rgb(20000000)
    Traceback (most recent call last):
    ...
    ValueError: Integer must be in range [0, 16777215], got 20000000.
    """
    if rgb_int < 0 or 16777215 < rgb_int:
        raise ValueError('Integer must be in range [0, 16777215], got {}.'.format(rgb_int))
    blue =  rgb_int & 255
    green = (rgb_int >> 8) & 255
    red =   (rgb_int >> 16) & 255
    return red, green, blue