def get_session_colormap(session, key):
    """
    Get the colormap form a legend stored in the user session and identified
    by key.
    """
    raster_legends = session.get('raster_legends', {})
    legend = raster_legends.get(key)
    if legend:
        return legend['colormap']