parameters: (code, symbol, default=-1)
docstring: Extract the constant value of 'symbol' from 'code'
  
      If the name 'symbol' is bound to a constant value by the Python code
      object 'code', return that value.  If 'symbol' is bound to an expression,
      return 'default'.  Otherwise, return 'None'.
  
      Return value is based on the first assignment to 'symbol'.  'symbol' must
      be a global, or at least a non-"fast" local in the code block.  That is,
      only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol'
      must be present in 'code.co_names'.
docstring_summary: Extract the constant value of 'symbol' from 'code'
docstring_tokens: Extract the constant value of symbol from code
function: def extract_constant(code, symbol, default=-1):
      """Extract the constant value of 'symbol' from 'code'
  
      If the name 'symbol' is bound to a constant value by the Python code
      object 'code', return that value.  If 'symbol' is bound to an expression,
      return 'default'.  Otherwise, return 'None'.
  
      Return value is based on the first assignment to 'symbol'.  'symbol' must
      be a global, or at least a non-"fast" local in the code block.  That is,
      only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol'
      must be present in 'code.co_names'.
      """
      if symbol not in code.co_names:
          # name's not there, can't possibly be an assignment
          return None
  
      name_idx = list(code.co_names).index(symbol)
  
      STORE_NAME = 90
      STORE_GLOBAL = 97
      LOAD_CONST = 100
  
      const = default
  
      for byte_code in Bytecode(code):
          op = byte_code.opcode
          arg = byte_code.arg
  
          if op == LOAD_CONST:
              const = code.co_consts[arg]
          elif arg == name_idx and (op == STORE_NAME or op == STORE_GLOBAL):
              return const
          else:
              const = default
function_tokens: def extract_constant ( code , symbol , default = - 1 ) : if symbol not in code . co_names : # name's not there, can't possibly be an assignment return None name_idx = list ( code . co_names ) . index ( symbol ) STORE_NAME = 90 STORE_GLOBAL = 97 LOAD_CONST = 100 const = default for byte_code in Bytecode ( code ) : op = byte_code . opcode arg = byte_code . arg if op == LOAD_CONST : const = code . co_consts [ arg ] elif arg == name_idx and ( op == STORE_NAME or op == STORE_GLOBAL ) : return const else : const = default