def colormapper(value, lower=0, upper=1, cmap=None):
    """
    Maps values to colors by normalizing within [a,b], obtaining rgba from the
    given matplotlib color map for heatmap polygon coloring.

    Parameters
    ----------
    value: float
        The value to be colormapped
    lower: float
        Lower bound of colors
    upper: float
        Upper bound of colors
    cmap: String or matplotlib.colors.Colormap (optional)
        Colormap object to prevent repeated lookup

    Returns
    -------
    hex_, float
        The value mapped to an appropriate RGBA color value
    """

    cmap = get_cmap(cmap)
    if upper - lower == 0:
        rgba = cmap(0)
    else:
        rgba = cmap((value - lower) / float(upper - lower))
    hex_ = rgb2hex(rgba)
    return hex_