text: import tweepy
  import logging
  import os
  from dotenv import load_dotenv, find_dotenv
  
  logger = logging.getLogger()
  load_dotenv(find_dotenv())
  
  consumer_key = os.getenv("CONSUMER_KEY")
  consumer_secret = os.getenv("CONSUMER_SECRET")
  access_token = os.getenv("ACCESS_TOKEN")
  access_token_secret = os.getenv("ACCESS_TOKEN_SECRET")
  
  
  def create_api():
      auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
      auth.set_access_token(access_token, access_token_secret)
      api = tweepy.API(
          auth, wait_on_rate_limit=True,
          wait_on_rate_limit_notify=True
      )
      try:
          api.verify_credentials()
      except Exception as e:
          logger.error("Error creating API", exc_info=True)
          raise e
      logger.info("API created")
      return api
  