input: def optimize_reverse_string(code: str) -> str:
      """Given a Python script that reverses a string, optimizes the function by 
      replacing the loop with a more efficient list slicing approach. 
  
      Example:
      >>> optimize_reverse_string('def reverse_string(string):\n  reversed_string = ""\n  for char in string:\n    reversed_string = char + reversed_string\n  return reversed_string')
      'def reverse_string(string):\n  return string[::-1]'
      """
output:     import re
      pattern = re.compile(r'def reverse_string\(string\):\n\s*reversed_string = ""\n\s*for char in string:\n\s*reversed_string = char \+ reversed_string\n\s*return reversed_string')
      replacement = 'def reverse_string(string):\n  return string[::-1]'
      return pattern.sub(replacement, code)