How to display rgb hex colors on terminal using python?

Using ANSI escape sequence, I can change the color of text that python prints. The example below prints “Hi World” in light blue.

#!/usr/bin/python3
print(f'33[38;5;117mHi World')

While this works I am limited to just 256 colors. Are there any terminals or extensions that allow me to print colors in hex triplets #000000-#FFFFFF using python?