input: Write a function to extract the value associated with a specified key in a nested JSON string.
  assert extract_value('{"key1": "value1", "key2": {"key3": "value2", "key4": [1,2,3]}, "key5": 5}', "key4") == [1,2,3]
  assert extract_value('{"a": 1, "b": {"c": {"d": 2}}}', "d") == 2
  assert extract_value('{"x": {"y": {"z": "found"}}}', "z") == "found"
output: import json
  
  def extract_value(json_str, key):
      def find_key(d, key):
          if key in d:
              return d[key]
          for k, v in d.items():
              if isinstance(v, dict):
                  result = find_key(v, key)
                  if result is not None:
                      return result
          return None
  
      data = json.loads(json_str)
      return find_key(data, key)