docstr: casts an arbitrary to the same type as this setting's value with key
  Example: cast_value("eta_noise_seed_delta", "12") -> returns 12 (an int rather than str)
docstr_tok: ["casts","an","arbitrary","to","the","same","type","as","this","setting","'s","value","with","key","Example",":","cast_value","(","``","eta_noise_seed_delta","''",",","``","12","''",")","-",">","returns","12","(","an","int","rather","than","str",")"]
code: def cast_value(self, key, value):
      """casts an arbitrary to the same type as this setting's value with key
      Example: cast_value("eta_noise_seed_delta", "12") -> returns 12 (an int rather than str)
      """
  
      if value is None:
          return None
  
      default_value = self.data_labels[key].default
      if default_value is None:
          default_value = getattr(self, key, None)
      if default_value is None:
          return None
  
      expected_type = type(default_value)
      if expected_type == bool and value == "False":
          value = False
      else:
          value = expected_type(value)
  
      return value
  
imports: import json
  import sys
  from dataclasses import dataclass
  import gradio
  from modules import errors
  from modules.shared_cmd_options import cmd_opts
label_desc: Use image node_id 13 for calling the Options obj's underlying member method code with example usage: obj.cast_value(key, value) and returns: value, None, None