docstr: Utility function to get the nearest previous call node.
  
  Sort call nodes list (copy of the list) by line number.
  Iterate over the call nodes list. If the call node's function name
  equals to `func_name`, set `nearest_call` to the node object.
  
  Args:
      current_lineno (int): Number of the current processed line.
      calls (list[ast.Assign]): List of call nodes.
      func_name (str): Name of the target function.
  
  Returns:
      ast.Call: The node of the nearest previous call `<func_name>()`.
docstr_tok: ["Utility","function","to","get","the","nearest","previous","call","node",".","Sort","call","nodes","list","(","copy","of","the","list",")","by","line","number",".","Iterate","over","the","call","nodes","list",".","If","the","call","node","'s","function","name","equals","to","`","func_name","`",",","set","`","nearest_call","`","to","the","node","object",".","Args",":","current_lineno","(","int",")",":","Number","of","the","current","processed","line",".","calls","(","list","[","ast.Assign","]",")",":","List","of","call","nodes",".","func_name","(","str",")",":","Name","of","the","target","function",".","Returns",":","ast.Call",":","The","node","of","the","nearest","previous","call","`","<","func_name",">","(",")","`","."]
code: def _get_nearest_func_call(current_lineno, calls, func_name):
      """
      Utility function to get the nearest previous call node.
  
      Sort call nodes list (copy of the list) by line number.
      Iterate over the call nodes list. If the call node's function name
      equals to `func_name`, set `nearest_call` to the node object.
  
      Args:
          current_lineno (int): Number of the current processed line.
          calls (list[ast.Assign]): List of call nodes.
          func_name (str): Name of the target function.
  
      Returns:
          ast.Call: The node of the nearest previous call `<func_name>()`.
      """
      for call in reversed(calls):
          if call.lineno < current_lineno:
              try:
                  if call.func.attr == func_name:
                      return call
              except AttributeError:
                  continue
  
      return None
  
imports: import re
  import ast
  import uuid
  from collections import defaultdict
  import astor
  import pandas
  from pandasai.helpers.path import find_project_root
  from pandasai.helpers.skills_manager import SkillsManager
  from pandasai.helpers.sql import extract_table_names
  from .node_visitors import AssignmentVisitor, CallVisitor
  from .save_chart import add_save_chart
  from .optional import import_dependency
  from ..exceptions import BadImportError, MaliciousQueryError, NoResultFoundError, InvalidConfigError
  from ..constants import WHITELISTED_BUILTINS, WHITELISTED_LIBRARIES
  from typing import Union, List, Generator, Any
  from ..helpers.logger import Logger
  from ..schemas.df_config import Config
  import logging
  import traceback
label_desc: Use image node_id 16 for calling the CodeManager obj's underlying member method code with example usage: obj._get_nearest_func_call(current_lineno, calls, func_name) and returns: None, call