code: def validate_keys(self):
          
          url = 'https://api.twitter.com/1.1/account/verify_credentials.json'
  
          keys_present = self.consumer_key and self.consumer_secret and \
                         self.access_token and self.access_token_secret
  
          if keys_present:
              try:
                  # Need to explicitly reconnect to confirm the current creds
                  # are used in the session object.
                  self.connect()
                  self.get(url)
              except requests.HTTPError as e:
                  if e.response.status_code == 401:
                      raise RuntimeError('Invalid credentials provided.')
                  else:
                      raise e
          else:
              raise RuntimeError('Incomplete credentials provided.')
docs: Validate the keys provided are authentic credentials.