Return the color theme to use

def get_color_theme(theme):
    '''
    Return the color theme to use
    '''
    # Keep the heavy lifting out of the module space
    import salt.utils.data
    import salt.utils.files
    import salt.utils.yaml
    if not os.path.isfile(theme):
        log.warning('The named theme %s if not available', theme)

    try:
        with salt.utils.files.fopen(theme, 'rb') as fp_:
            colors = salt.utils.data.decode(salt.utils.yaml.safe_load(fp_))
            ret = {}
            for color in colors:
                ret[color] = '\033[{0}m'.format(colors[color])
            if not isinstance(colors, dict):
                log.warning('The theme file %s is not a dict', theme)
                return {}
            return ret
    except Exception:
        log.warning('Failed to read the color theme %s', theme)
        return {}