code: def add_magic(code, script_path):
      """Modifies the code to support magic Streamlit commands.
  
      Parameters
      ----------
      code : str
          The Python code.
      script_path : str
          The path to the script file.
  
      Returns
      -------
      ast.Module
          The syntax tree for the code.
  
      """
      # Pass script_path so we get pretty exceptions.
      tree = ast.parse(code, script_path, "exec")
  
      file_ends_in_semicolon = _does_file_end_in_semicolon(tree, code)
  
      return _modify_ast_subtree(
          tree,
          is_root=True,
          file_ends_in_semicolon=file_ends_in_semicolon,
      )
  
file_path: streamlit/lib/streamlit/runtime/scriptrunner/magic.py
imports: import ast
  from typing_extensions import Final
  from streamlit import config
label_desc: Use image node_id 1 for calling a global function with example usage: add_magic(code, script_path) and returns: _modify_ast_subtree