input: Write a function to parse a json-formatted string into a Python dictionary. The function should return the resulting dictionary. If the input string is not valid JSON, the function should raise a ValueError.
  assert parse_json('{"name": "John","age": 30,"address": {"city": "New York","state": "NY"}}')=={'name': 'John', 'age': 30, 'address': {'city': 'New York', 'state': 'NY'}}
  assert parse_json('{"name": "Alice","age": 25}')=={'name': 'Alice', 'age': 25}
  try:
      parse_json('invalid JSON string')
  except ValueError:
      pass
output: import json
  
  def parse_json(json_str):
      try:
          return json.loads(json_str)
      except json.JSONDecodeError:
          raise ValueError("Invalid JSON string")