code: def call_notion_api(
      self,
      method_name: str = None,
      params: dict = None,
      filters: list = None,
  ):
      # method > table > columns
      expansions_map = {
          "database": {
              "page": ["id", "url", "properties"],
          },
          "page": {
              "properties": ["Name"],
          },
      }
  
      self.api = self.connect()
      # use the service as the resource to query(database, page, block, comment)
      # and query as the type of method(retrieve, list, query)
      parts = method_name.split(".")
      if len(parts) == 2:
          service, query = parts
          if service in ["databases", "pages", "blocks", "comments"]:
              method = getattr(self.api, service)
              method = getattr(method, query)
      else:
          service, children, query = parts
          if service in ["blocks"]:
              method = getattr(self.api, service)
              method = getattr(method, children)
              method = getattr(method, query)
  
      count_results = None
      data = []
      includes = defaultdict(list)
  
      max_page_size = 100
      left = None
  
      limit_exec_time = time.time() + 60
  
      if filters:
          # if we have filters: do big page requests
          params["max_results"] = max_page_size
  
      chunk = []
      while True:
          if time.time() > limit_exec_time:
              raise RuntimeError("Handler request timeout error")
  
          if count_results is not None:
              left = count_results - len(data)
              if left == 0:
                  break
              elif left < 0:
                  # got more results that we need
                  data = data[:left]
                  break
  
          logger.debug(f">>>notion in: {method_name}({params})")
  
          resp = method(**params)
  
          if hasattr(resp, "includes"):
              for table, records in resp.includes.items():
                  includes[table].extend([r.data for r in records])
          if resp.get("results"):
              # database and comment api has list of results
              if isinstance(resp["results"], list):
                  chunk = [r for r in resp["results"]]
          else:
              if resp.get("object") in ["page", "block"]:
                  chunk = [resp]
  
          if filters:
              chunk = self._apply_filters(chunk, filters)
  
          # limit output
          if left is not None:
              chunk = chunk[:left]
  
          data.extend(chunk)
          if (
              count_results is not None
              and hasattr(resp, "meta")
              and "next_token" in resp.meta
          ):
              params["next_token"] = resp.meta["next_token"]
          else:
              break
  
      df = pd.DataFrame(data)
  
      # enrich
      expansions = expansions_map.get(method_name)
      if expansions is not None:
          for table, records in includes.items():
              df_ref = pd.DataFrame(records)
  
              if table not in expansions:
                  continue
  
              for col_id in expansions[table]:
                  col = col_id[:-3]  # cut _id
                  if col_id not in df.columns:
                      continue
  
                  col_map = {
                      col_ref: f"{col}_{col_ref}"
                      for col_ref in df_ref.columns
                  }
                  df_ref2 = df_ref.rename(columns=col_map)
                  df_ref2 = df_ref2.drop_duplicates(col_id)
  
                  df = df.merge(df_ref2, on=col_id, how="left")
  
      return df
  
file_path: mindsdb/mindsdb/integrations/handlers/notion_handler/notion_handler.py
imports: import time
  import pandas
  from collections import defaultdict
  from notion_client import Client
  from mindsdb.utilities import log
  from mindsdb.integrations.libs.api_handler import APIHandler
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse, RESPONSE_TYPE
  from .notion_table import NotionBlocksTable, NotionCommentsTable, NotionDatabaseTable, NotionPagesTable
label_desc: Use image node_id 6 for calling the NotionHandler obj's underlying member method code with example usage: obj.call_notion_api(method_name, params, filters) and returns: df