def reverse_colourmap(cdict):
    """ Returns the inverted colorbar dictionary.

   I most definitely got this from the web somewhere ... Stackoverflow?

   :params cdict: a colorbar dictionary
   :type cdict: dict

   :return: the flipped dictionary
   :rtype: dict

   """
    new_cdict = {}
    for channel in cdict:
        data = []
        for t in cdict[channel]:
            data.append((1.0 - t[0], t[1], t[2]))
        new_cdict[channel] = data[::-1]
    return new_cdict
