input: Write a function to detect and fix Python syntax errors in a given code snippet. If the code snippet contains valid Python syntax, return the corrected code. If the code snippet contains invalid Python syntax, return the corrected code along with an appropriate error message.
  
  def fix_python_syntax(code_snippet):
      try:
          exec(code_snippet)
      except SyntaxError as se:
          return f"SyntaxError: {se}"
      except NameError as ne:
          return f"NameError: {ne}"
      return code_snippet
  
  assert fix_python_syntax("def test (): x = 5 y = 3 z") == \
  """def test():
      x = 5
      y = 3
      try:
          z
      except NameError:
          print("NameError: Name 'z' is not defined")"""
  
  assert fix_python_syntax("def test(): x = 5 y = 3 z") == \
  """def test():
      x = 5
      y = 3
      try:
          z
      except NameError:
          print("NameError: Name 'z' is not defined")"""
  
  assert fix_python_syntax("def test(): x = 5; y = 3; z") == \
  """def test():
      x = 5
      y = 3
      try:
          z
      except NameError:
          print("NameError: Name 'z' is not defined")"""
  
  assert fix_python_syntax("def test(): x = 5; y = 3; print(z+1)") == \
  """def test():
      x = 5
      y = 3
      try:
          print(z + 1)
      except NameError:
          print("NameError: Name 'z' is not defined")"""
  
  assert fix_python_syntax("def test(): pass") == "def test(): pass"
output: def fix_python_syntax(code_snippet):
      try:
          exec(code_snippet)
      except SyntaxError as se:
          if "invalid syntax" in str(se):
              lines = code_snippet.split('\n')
              corrected_lines = []
              for line in lines:
                  if ';' in line:
                      corrected_lines.append(line.replace(';', '\n'))
                  else:
                      corrected_lines.append(line)
              corrected_code = '\n'.join(corrected_lines)
              return corrected_code
          return f"SyntaxError: {se}"
      except NameError as ne:
          return f"NameError: {ne}"
      return code_snippet