This code tests that the insecure variable is True or False. This is assuming that the user is providing a YAML value. However, if this value is set via an intrinsic function, the value will be evaluated as string, because all intrinsic function values are strings.
Basically, want to change something from fig 1 to something essentially the same as fig2 :
fig 1:
verify = not (cfg[AUTH_PARAM_INSECURE] is True)
fig 2:
cfg_insecure = cfg[AUTH_PARAM_INSECURE]
if isinstance(cfg_insecure, basestring) and cfg_insecure.Capitalize() == 'True':
cfg[AUTH_PARAM_INSECURE] = True
verify = not (cfg[AUTH_PARAM_INSECURE] is True)