class_docstr: Contains information about accounts.
  `path`: Path to sqlite file where the information about accounts is stored.
docstr: Generate a new API key for an account (admin-only).
docstr_tok: ["Generate","a","new","API","key","for","an","account","(","admin-only",")","."]
code: def rotate_api_key(
      self, auth: Authentication, account: Account
  ) -> Account:
      """
      Generate a new API key for an account (admin-only).
      """
      with SqliteDict(self.path) as cache:
          self._check_admin_with_cache(auth, cache)
  
          old_api_key: str = account.api_key
          new_api_key: str = self._generate_nonexistent_api_key()
  
          account_dict = cache.get(old_api_key)
          if not account_dict:
              raise ValueError(
                  f"Account with API key {old_api_key} does not exist."
              )
  
          account = from_dict(Account, account_dict)
          account.api_key = new_api_key
          cache[new_api_key] = asdict(account)
          del cache[old_api_key]
          cache.commit()
          return account
  
imports: import copy
  import datetime
  import random
  import string
  from typing import Dict, Optional, Callable, List
  from dacite import from_dict
  from dataclasses import asdict, dataclass, field
  from sqlitedict import SqliteDict
  from helm.common.authentication import Authentication
  from helm.common.general import hlog
label_desc: Use image node_id 10 for calling the Accounts obj's underlying member method code with example usage: obj.rotate_api_key(auth, account) and returns: account