RGB color + Color Temperature conversion to Hue+Sat or XYcolor

Is there a python library that can convert a given RGB color + CT (Color Temperature) to a Philips HUE XY-color or Hue+Sat?

I am programmatically modifying CT during the day but would like to keep the lights at the color (or close to) that what was set by the user.

I started to answer my own question here and i came up with the following:

  1. Convert RGB to XY
  2. Convert XY to CT

The following is a plot of CT on gamut B in the CIE diagram, can someone comment on this if it is correct or not?
(white=ct:500, black=ct:154)