code: def compile_speedup():
      
      import os
      import ctypes
      from os.path import join, dirname, getmtime, exists, expanduser
      # library = join(dirname(__file__), '_xterm256.so')
      library = expanduser('~/.xterm256.so')
      sauce = join(dirname(__file__), '_xterm256.c')
      if not exists(library) or getmtime(sauce) > getmtime(library):
          build = "gcc -fPIC -shared -o %s %s" % (library, sauce)
          if (os.system(build + " >/dev/null 2>&1") != 0):
              raise OSError("GCC error")
      xterm256_c = ctypes.cdll.LoadLibrary(library)
      xterm256_c.init()
      def xterm_to_rgb(xcolor):
          res = xterm256_c.xterm_to_rgb_i(xcolor)
          return ((res >> 16) & 0xFF, (res >> 8) & 0xFF, res & 0xFF)
      return (xterm256_c.rgb_to_xterm, xterm_to_rgb)
docs: Tries to compile/link the C version of this module
  
      Like it really makes a huge difference.  With a little bit of luck
      this should *just work* for you.
  
      You need:
  
      - Python >= 2.5 for ctypes library
      - gcc (``sudo apt-get install gcc``)