docstr: Add whitelisted imports to _additional_dependencies.
  
  Args:
      node (object): ast.Import or ast.ImportFrom
  
  Raises:
      BadImportError: If the import is not whitelisted
docstr_tok: ["Add","whitelisted","imports","to","_additional_dependencies",".","Args",":","node","(","object",")",":","ast.Import","or","ast.ImportFrom","Raises",":","BadImportError",":","If","the","import","is","not","whitelisted"]
code: def _check_imports(self, node: Union[ast.Import, ast.ImportFrom]):
      """
      Add whitelisted imports to _additional_dependencies.
  
      Args:
          node (object): ast.Import or ast.ImportFrom
  
      Raises:
          BadImportError: If the import is not whitelisted
  
      """
      module = (
          node.names[0].name
          if isinstance(node, ast.Import)
          else node.module
      )
      library = module.split(".")[0]
  
      if library == "pandas":
          return
  
      if (
          library
          in WHITELISTED_LIBRARIES
          + self._config.custom_whitelisted_dependencies
      ):
          for alias in node.names:
              self._additional_dependencies.append(
                  {
                      "module": module,
                      "name": alias.name,
                      "alias": alias.asname or alias.name,
                  }
              )
          return
  
      if library not in WHITELISTED_BUILTINS:
          raise BadImportError(library)
  
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 15 for calling the CodeManager obj's underlying member method code with example usage: obj._check_imports(node) without return types