class_docstr: Base for interaction with Databricks.
  
  :param databricks_conn_id: Reference to the :ref:`Databricks connection <howto/connection:databricks>`.
  :param timeout_seconds: The amount of time in seconds the requests library
      will wait before timing-out.
  :param retry_limit: The number of times to retry the connection in case of
      service outages.
  :param retry_delay: The number of seconds to wait between retries (it
      might be a floating point number).
  :param retry_args: An optional dictionary with arguments passed to ``tenacity.Retrying`` class.
class_docstr_tok: ["Base","for","interaction","with","Databricks",".",":","param","databricks_conn_id",":","Reference","to","the",":","ref",":","`","Databricks","connection","<","howto\/connection",":","databricks",">","`",".",":","param","timeout_seconds",":","The","amount","of","time","in","seconds","the","requests","library","will","wait","before","timing-out",".",":","param","retry_limit",":","The","number","of","times","to","retry","the","connection","in","case","of","service","outages",".",":","param","retry_delay",":","The","number","of","seconds","to","wait","between","retries","(","it","might","be","a","floating","point","number",")",".",":","param","retry_args",":","An","optional","dictionary","with","arguments","passed","to","``","tenacity.Retrying","``","class","."]
code: def _get_token(self, raise_error: bool = False) -> str | None:
      if "token" in self.databricks_conn.extra_dejson:
          self.log.info(
              "Using token auth. For security reasons, please set token in Password field instead of extra"
          )
          return self.databricks_conn.extra_dejson["token"]
      elif (
          not self.databricks_conn.login
          and self.databricks_conn.password
      ):
          self.log.info("Using token auth.")
          return self.databricks_conn.password
      elif "azure_tenant_id" in self.databricks_conn.extra_dejson:
          if (
              self.databricks_conn.login == ""
              or self.databricks_conn.password == ""
          ):
              raise AirflowException(
                  "Azure SPN credentials aren't provided"
              )
          self.log.info("Using AAD Token for SPN.")
          return self._get_aad_token(DEFAULT_DATABRICKS_SCOPE)
      elif self.databricks_conn.extra_dejson.get(
          "use_azure_managed_identity", False
      ):
          self.log.info("Using AAD Token for managed identity.")
          self._check_azure_metadata_service()
          return self._get_aad_token(DEFAULT_DATABRICKS_SCOPE)
      elif self.databricks_conn.extra_dejson.get(
          "service_principal_oauth", False
      ):
          if (
              self.databricks_conn.login == ""
              or self.databricks_conn.password == ""
          ):
              raise AirflowException(
                  "Service Principal credentials aren't provided"
              )
          self.log.info("Using Service Principal Token.")
          return self._get_sp_token(
              OIDC_TOKEN_SERVICE_URL.format(self.databricks_conn.host)
          )
      elif raise_error:
          raise AirflowException(
              "Token authentication isn't configured"
          )
  
      return None
  
imports: from __future__ import annotations
  import copy
  import platform
  import time
  from functools import cached_property
  from typing import TYPE_CHECKING, Any
  from urllib.parse import urlsplit
  import aiohttp
  import requests
  from requests import PreparedRequest, exceptions
  from requests.auth import AuthBase, HTTPBasicAuth
  from requests.exceptions import JSONDecodeError
  from tenacity import AsyncRetrying, RetryError, Retrying, retry_if_exception, stop_after_attempt, wait_exponential
  from airflow import __version__
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
  from airflow.providers_manager import ProvidersManager
label_desc: Use image node_id 15 for calling the BaseDatabricksHook obj's underlying member method code with example usage: obj._get_token(raise_error) and returns: None, self, self, self, self, self