def _color_variant(hex_color, brightness_offset=<NUM_LIT:1>):
if len(hex_color) != <NUM_LIT:7>:<EOL><INDENT>raise Exception("<STR_LIT>" % hex_color)<EOL><DEDENT>rgb_hex = [hex_color[x:x+<NUM_LIT:2>] for x in [<NUM_LIT:1>, <NUM_LIT:3>, <NUM_LIT:5>]]<EOL>new_rgb_int = [int(hex_value, <NUM_LIT:16>) + brightness_offset for hex_value in rgb_hex]<EOL>new_rgb_int = [min([<NUM_LIT:255>, max([<NUM_LIT:0>, i])]) for i in new_rgb_int] <EOL>new_color = "<STR_LIT:#>"<EOL>for i in new_rgb_int:<EOL><INDENT>if len(hex(i)[<NUM_LIT:2>:]) == <NUM_LIT:2>:<EOL><INDENT>new_color += hex(i)[<NUM_LIT:2>:]<EOL><DEDENT>else:<EOL><INDENT>new_color += hex(i)[<NUM_LIT:2>:] + "<STR_LIT:0>"<EOL><DEDENT><DEDENT>return new_color<EOL>
Takes a color like #87c95f and produces a lighter or darker variant.
    Code adapted from method proposed by Chase Seibert at:
    http://chase-seibert.github.io/blog/2011/07/29/python-calculate-lighterdarker-rgb-colors.html.

    Args:
        hex_color (str): The original hex color.
        brightness_offset (int): The amount to shift the color by.

    Returns:
        new_color (str): The new hex color variant.

    Raises:
        Exception: if the len of the hex_color isn't the appropriate length (7).