def bool_value(self):
context = contextmod.InferenceContext()<EOL>context.callcontext = contextmod.CallContext(args=[])<EOL>context.boundnode = self<EOL>try:<EOL><INDENT>result = _infer_method_result_truth(self, BOOL_SPECIAL_METHOD, context)<EOL><DEDENT>except (exceptions.InferenceError, exceptions.AttributeInferenceError):<EOL><INDENT>try:<EOL><INDENT>result = _infer_method_result_truth(self, "<STR_LIT>", context)<EOL><DEDENT>except (exceptions.AttributeInferenceError, exceptions.InferenceError):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return result<EOL>
Infer the truth value for an Instance

        The truth value of an instance is determined by these conditions:

           * if it implements __bool__ on Python 3 or __nonzero__
             on Python 2, then its bool value will be determined by
             calling this special method and checking its result.
           * when this method is not defined, __len__() is called, if it
             is defined, and the object is considered true if its result is
             nonzero. If a class defines neither __len__() nor __bool__(),
             all its instances are considered true.