code: def parse_bool(cls, value, default=None):
          
          if value is None:
              return default
  
          elif isinstance(value, bool):
              return value
  
          elif isinstance(value, str):
              if value == 'True':
                  return True
              elif value == 'False':
                  return False
  
          raise Exception("Value %s is not boolean." % value)
docs: Convert ``string`` or ``bool`` to ``bool``.