code: def infer_bool(node, context=None):
      
      if len(node.args) > 1:
          # Invalid bool call.
          raise UseInferenceDefault
  
      if not node.args:
          return nodes.Const(False)
  
      argument = node.args[0]
      try:
          inferred = next(argument.infer(context=context))
      except InferenceError:
          return util.Uninferable
      if inferred is util.Uninferable:
          return util.Uninferable
  
      bool_value = inferred.bool_value()
      if bool_value is util.Uninferable:
          return util.Uninferable
      return nodes.Const(bool_value)
docs: Understand bool calls.