def grayscale(decimal, darkest=0, lightest=255, reverse=False, lower=0, upper=1
    ):
    """
    Converts a decimal value to a hex RGB grayscale value
    between a max and min shade (default is 0-255).

    By default, lower values mean lighter shades of gray.
    The function will return a value based on the location of the input
    between the given lower and upper values for input
    (by default 0 and 1, respectively)
    """
    if decimal < lower or decimal > upper:
        return '#FFFFFF'
    scale = upper - lower
    percent = (decimal - lower) / scale
    if reverse == False:
        percent = 1 - percent
    shade_scale = lightest - darkest
    value = percent * shade_scale + darkest
    temp_string = hex(int(value))
    hex_scale = temp_string.split('x')[1]
    while len(hex_scale) < 2:
        hex_scale = '0' + hex_scale
    hex_string = '#' + hex_scale * 3
    return hex_string
