code: def _get_last_line(node_or_leaf):
      last_leaf = node_or_leaf.get_last_leaf()
      if _ends_with_newline(last_leaf):
          return last_leaf.start_pos[0]
      else:
          n = last_leaf.get_next_leaf()
          if n.type == "endmarker" and "\n" in n.prefix:
              # This is a very special case and has to do with error recovery in
              # Parso. The problem is basically that there's no newline leaf at
              # the end sometimes (it's required in the grammar, but not needed
              # actually before endmarker, CPython just adds a newline to make
              # source code pass the parser, to account for that Parso error
              # recovery allows small_stmt instead of simple_stmt).
              return last_leaf.end_pos[0] + 1
          return last_leaf.end_pos[0]
  
imports: import re
  import difflib
  from collections import namedtuple
  import logging
  from parso.utils import split_lines
  from parso.python.parser import Parser
  from parso.python.tree import EndMarker
  from parso.python.tokenize import PythonToken, BOM_UTF8_STRING
  from parso.python.token import PythonTokenTypes
label_desc: Use image node_id 9 for calling a global function with example usage: _get_last_line(node_or_leaf) and returns: last_leaf, last_leaf, unknown