code: def _ConvertBool(value, require_str):
      """Convert a boolean value.
  
      Args:
        value: A scalar value to convert.
        require_str: If True, value must be a str.
  
      Returns:
        The bool parsed.
  
      Raises:
        ParseError: If a boolean value couldn't be consumed.
      """
      if require_str:
          if value == "true":
              return True
          elif value == "false":
              return False
          else:
              raise ParseError(
                  'Expected "true" or "false", not {0}.'.format(value)
              )
  
      if not isinstance(value, bool):
          raise ParseError("Expected true or false without quotes.")
      return value
  
imports: import base64
  import json
  import math
  from operator import methodcaller
  import re
  import sys
  import six
  from google.protobuf.internal import type_checkers
  from google.protobuf import descriptor
  from google.protobuf import symbol_database
label_desc: Use image node_id 12 for calling a global function with example usage: _ConvertBool(value, require_str) and returns: value, True, False