code: def _does_file_end_in_semicolon(tree, code):
      file_ends_in_semicolon = False
  
      # Avoid spending time with this operation if magic.displayLastExprIfNoSemicolon is
      # not set.
      if config.get_option("magic.displayLastExprIfNoSemicolon"):
          last_line_num = getattr(tree.body[-1], "end_lineno", None)
  
          if last_line_num is not None:
              last_line_str = code.split("\n")[last_line_num - 1]
              file_ends_in_semicolon = last_line_str.strip(
                  " "
              ).endswith(";")
  
      return 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 9 for calling a global function with example usage: _does_file_end_in_semicolon(tree, code) and returns: file_ends_in_semicolon