def colortopalette(color, palette):
 """
 Convert given color into palette color.
 """
 for a,b in palette:
  if color >= a and color < b:
   return b

 Convert given color into palette color.
 
recipes/Python/576689_Copymove_forgery/recipe-576689.py