class_docstr: Contains information about accounts.
  `path`: Path to sqlite file where the information about accounts is stored.
docstr: Updates the usages: account with `api_key` has used `delta` tokens of `model_group`.
docstr_tok: ["Updates","the","usages",":","account","with","`","api_key","`","has","used","`","delta","`","tokens","of","`","model_group","`","."]
code: def use(self, api_key: str, model_group: str, delta: int):
      """
      Updates the usages: account with `api_key` has used `delta` tokens of `model_group`.
      """
  
      def granular_use(
          account: Account,
          model_group: str,
          granularity: str,
          compute_period: Callable[[], str],
      ):
          """Helper that checks the usage at a certain granularity (e.g., daily, monthly, total)."""
          # Even if usages don't exist, still keep track.
          model_group_usages = account.usages.get(model_group)
          if model_group_usages is None:
              model_group_usages = account.usages[model_group] = {}
  
          usage = model_group_usages.get(granularity)
          if usage is None:
              usage = model_group_usages[granularity] = Usage()
  
          period = compute_period()
          usage.update_period(period)
          usage.used += delta
  
      if self.root_mode:
          return
  
      with SqliteDict(self.path) as cache:
          account: Account = from_dict(Account, cache[api_key])
          granular_use(
              account, model_group, "daily", compute_daily_period
          )
          granular_use(
              account, model_group, "monthly", compute_monthly_period
          )
          granular_use(
              account, model_group, "total", compute_total_period
          )
          cache[api_key] = asdict(account)
          cache.commit()
  
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 14 for calling the Accounts obj's underlying member method code with example usage: obj.use(api_key, model_group, delta) without return types