code: def bool_value(self):
          
          context = contextmod.InferenceContext()
          context.callcontext = contextmod.CallContext(args=[])
          context.boundnode = self
  
          try:
              result = _infer_method_result_truth(self, BOOL_SPECIAL_METHOD, context)
          except (exceptions.InferenceError, exceptions.AttributeInferenceError):
              # Fallback to __len__.
              try:
                  result = _infer_method_result_truth(self, "__len__", context)
              except (exceptions.AttributeInferenceError, exceptions.InferenceError):
                  return True
          return result
docs: 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.