docs: def _cast_to_type(self, value):
          """ Convert the value to a boolean and raise error on failures"""
          if value in (True, False):
              return bool(value)
          if value in ('t', 'True', '1'):
              return True
          if value in ('f', 'False', '0'):
              return False
          self.fail('invalid', value=value)