docstr: Creates a usable dask client or returns an existing one
  
  If there is not current client, because it has been closed, create
  a new one.
  * If ``n_jobs == 1``, create a ``SingleThreadedClient``
  * Else create a ``Client`` with a ``LocalCluster``
docstr_tok: ["Creates","a","usable","dask","client","or","returns","an","existing","one","If","there","is","not","current","client",",","because","it","has","been","closed",",","create","a","new","one",".","*","If","``","n_jobs","==","1","``",",","create","a","``","SingleThreadedClient","``","*","Else","create","a","``","Client","``","with","a","``","LocalCluster","``"]
code: def client(self) -> Client:
      """Creates a usable dask client or returns an existing one
  
      If there is not current client, because it has been closed, create
      a new one.
      * If ``n_jobs == 1``, create a ``SingleThreadedClient``
      * Else create a ``Client`` with a ``LocalCluster``
      """
      if self._client is not None:
          return self._client
  
      if self.n_jobs == 1:
          cluster = None
          client = SingleThreadedClient()
      else:
          cluster = LocalCluster(
              n_workers=self.n_jobs,
              processes=False,
              threads_per_worker=1,
              # We use tmpdir to save the workers as deleting workers takes
              # more time than deleting backend directories.
              # This prevent an error saying that the worker file was deleted,
              # so the client could not close the worker properly
              local_directory=tempfile.gettempdir(),
              # Memory is handled by the pynisher, not by the dask worker/nanny
              memory_limit=0,
          )
          client = Client(cluster, heartbeat_interval=10000)  # 10s
  
      self._client = client
      self._cluster = cluster
      return self._client
  
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  from typing import Any
  import tempfile
  from dask.distributed import Client, LocalCluster
  from autosklearn.util.single_thread_client import SingleThreadedClient
label_desc: Use image node_id 2 for calling the LocalDask obj's underlying member method code with example usage: obj.client() and returns: self, self