class_docstr: A class for handling connections and interactions with the Twitter API.
  
  Attributes:
      bearer_token (str): The consumer key for the Twitter app.
      api (tweepy.API): The `tweepy.API` object for interacting with the Twitter API.
code: def check_connection(self) -> StatusResponse:
      response = StatusResponse(False)
  
      try:
          api = self.connect()
  
          # call get_user with unknown id.
          #   it raises an error in case if auth is not success and returns not-found otherwise
          #   api.get_me() is not exposed for OAuth 2.0 App-only authorisation
          api.get_user(id=1)
          response.success = True
  
      except tweepy.Unauthorized as e:
          response.error_message = f"Error connecting to Twitter api: {e}. Check bearer_token"
          logger.error(response.error_message)
  
      if response.success is True and len(self.connection_args) > 1:
          # not only bearer_token, check read-write mode (OAuth 2.0 Authorization Code with PKCE)
          try:
              api = self.connect()
  
              api.get_me()
  
          except tweepy.Unauthorized as e:
              keys = (
                  "consumer_key",
                  "consumer_secret",
                  "access_token",
                  "access_token_secret",
              )
              response.error_message = (
                  f"Error connecting to Twitter api: {e}. Check"
                  + ", ".join(keys)
              )
              logger.error(response.error_message)
  
              response.success = False
  
      if response.success is False and self.is_connected is True:
          self.is_connected = False
  
      return response
  
imports: import re
  import os
  import datetime
  import ast
  import time
  from collections import defaultdict
  import pytz
  import io
  import requests
  import pandas
  import tweepy
  from mindsdb.utilities import log
  from mindsdb.utilities.config import Config
  from mindsdb_sql.parser import ast
  from mindsdb.integrations.libs.api_handler import APIHandler, APITable, FuncParser
  from mindsdb.integrations.utilities.sql_utils import extract_comparison_conditions
  from mindsdb.integrations.utilities.date_utils import parse_utc_date
  from mindsdb.integrations.libs.response import HandlerStatusResponse, HandlerResponse, RESPONSE_TYPE
label_desc: Use image node_id 4 for calling the TwitterHandler obj's underlying member method code with example usage: obj.check_connection() and returns: response