def get_color_theme(theme):
 import yaml
 if (not os.path.isfile(theme)):
  log.warning('The named theme {0} if not available'.format(theme))
 try:
  with fopen(theme, 'rb') as fp_:
   colors = yaml.safe_load(fp_.read())
   ret = {}
   for color in colors:
    ret[color] = '\x1b[{0}m'.format(colors[color])
   if (not isinstance(colors, dict)):
    log.warning('The theme file {0} is not a dict'.format(theme))
    return {}
   return ret
 except Exception:
  log.warning('Failed to read the color theme {0}'.format(theme))
  return {}

def get_color_theme ( theme ) : import yaml if ( not os . path . isfile ( theme ) ) : log . warning ( 'The named theme {0} if not available' . format ( theme ) ) try : with fopen ( theme , 'rb' ) as fp_ : colors = yaml . safe_load ( fp_ . read ( ) ) ret = { } for color in colors : ret [ color ] = '\x1b[{0}m' . format ( colors [ color ] ) if ( not isinstance ( colors , dict ) ) : log . warning ( 'The theme file {0} is not a dict' . format ( theme ) ) return { } return ret except Exception : log . warning ( 'Failed to read the color theme {0}' . format ( theme ) ) return { }
return the color theme to use .