code: def fetch_messages(self, params, df=False):
      limit = int(params.get("limit", 1000))
      sid = params.get("sid", None)
      # Convert date strings to datetime objects if provided
      date_sent_after = params.get("date_sent_after", None)
      date_sent_before = params.get("date_sent_before", None)
      # Extract 'from_' and 'body' search criteria from params
      from_number = params.get("from_number", None)
      to_number = params.get("to_number", None)
      args = {
          "limit": limit,
          "date_sent_after": date_sent_after,
          "date_sent_before": date_sent_before,
          "from_": from_number,
          "to": to_number,
      }
  
      args = {arg: val for arg, val in args.items() if val is not None}
      if sid:
          messages = [self.client.messages(sid).fetch()]
      else:
          messages = self.client.messages.list(**args)
  
      # Extract all possible properties for each message
      data = []
      for msg in messages:
          msg_data = {
              "sid": msg.sid,
              "to_number": msg.to,
              "from_number": msg.from_,
              "body": msg.body,
              "direction": msg.direction,
              "msg_status": msg.status,
              "sent_at": msg.date_created.replace(tzinfo=None),
              "account_sid": msg.account_sid,
              "price": msg.price,
              "price_unit": msg.price_unit,
              "api_version": msg.api_version,
              "uri": msg.uri,
              # 'media_url': [media.uri for media in msg.media.list()]
              # ... Add other properties as needed
          }
          data.append(msg_data)
  
      if df is True:
          return pd.DataFrame(data)
      return Response(
          RESPONSE_TYPE.TABLE, data_frame=pd.DataFrame(data)
      )
  
imports: import os
  import re
  from twilio.rest import Client
  import pandas
  from mindsdb.integrations.libs.api_handler import APIHandler, APITable
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse, RESPONSE_TYPE
  from mindsdb.utilities.config import Config
  from mindsdb.utilities import log
  from mindsdb.integrations.utilities.date_utils import parse_local_date
  from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions, project_dataframe, filter_dataframe
  from mindsdb_sql.parser import ast
label_desc: Use image node_id 7 for calling the TwilioHandler obj's underlying member method code with example usage: obj.fetch_messages(params, df) and returns: Response, pd