def use_ansi_escape_colorbold_composites():
 color_codes = {}
 for (color_name, color_escape) in colors.items():
  color_code = color_escape.replace(u'\x1b[', u'').replace(u'm', u'')
  color_codes[color_name] = color_code
 for alias in aliases:
  parts = [color_codes[c] for c in aliases[alias].split(',')]
  composite_escape = u'\x1b[{0}m'.format(u';'.join(parts))
  escapes[alias] = composite_escape
  arg_alias = (alias + '_arg')
  arg_seq = aliases.get(arg_alias, (aliases[alias] + ',bold'))
  parts = [color_codes[c] for c in arg_seq.split(',')]
  composite_escape = u'\x1b[{0}m'.format(u';'.join(parts))
  escapes[arg_alias] = composite_escape

def use_ansi_escape_colorbold_composites ( ) : color_codes = { } for ( color_name , color_escape ) in colors . items ( ) : color_code = color_escape . replace ( u'\x1b[' , u'' ) . replace ( u'm' , u'' ) color_codes [ color_name ] = color_code for alias in aliases : parts = [ color_codes [ c ] for c in aliases [ alias ] . split ( ',' ) ] composite_escape = u'\x1b[{0}m' . format ( u';' . join ( parts ) ) escapes [ alias ] = composite_escape arg_alias = ( alias + '_arg' ) arg_seq = aliases . get ( arg_alias , ( aliases [ alias ] + ',bold' ) ) parts = [ color_codes [ c ] for c in arg_seq . split ( ',' ) ] composite_escape = u'\x1b[{0}m' . format ( u';' . join ( parts ) ) escapes [ arg_alias ] = composite_escape
patch for "sphinxcontrib-ansi" to process the following ansi escapes correctly : esc[{color}mesc[1m => esc[{color};1m reapply aliases to ansi escapes mapping .