input: Write a python function to extract the value for a given key from a JSON string.
  assert get_value_from_json('{"key1": "value1", "key2": "value2"}', 'key1') == 'value1'
  assert get_value_from_json('{"key1": "value1", "key2": "value2"}', 'key2') == 'value2'
  assert get_value_from_json('{"key3": "value3", "key4": "value4"}', 'key3') == 'value3'
output: import json
  
  def get_value_from_json(json_str, key):
      data = json.loads(json_str)
      return data[key]