class_docstr: Implement a generic protocol to allow Orion to communicate using
  different storage backend
class_docstr_tok: ["Implement","a","generic","protocol","to","allow","Orion","to","communicate","using","different","storage","backend"]
docstr: Write algorithm lock for given experiment
  
  Parameters
  ----------
  experiment_id: int or str
      ID of the experiment in storage.
  algorithm_config: dict
      Configuration of the algorithm.
  locked: int
      Whether algorithm is locked (1) or not (0, default).
  state: dict, optional
      Optional algorithm state.
  heartbeat: datetime, optional
      Algorithm heartbeat. Default to datetime.utcnow().
docstr_tok: ["Write","algorithm","lock","for","given","experiment","Parameters","--","--","--","--","--","experiment_id",":","int","or","str","ID","of","the","experiment","in","storage",".","algorithm_config",":","dict","Configuration","of","the","algorithm",".","locked",":","int","Whether","algorithm","is","locked","(","1",")","or","not","(","0",",","default",")",".","state",":","dict",",","optional","Optional","algorithm","state",".","heartbeat",":","datetime",",","optional","Algorithm","heartbeat",".","Default","to","datetime.utcnow","(",")","."]
code: def write_algorithm_lock(
      self,
      experiment_id: int | str,
      algorithm_config: dict,
      locked: int = 0,
      state: dict | None = None,
      heartbeat: datetime | None = None,
  ):
      """Write algorithm lock for given experiment
  
      Parameters
      ----------
      experiment_id: int or str
          ID of the experiment in storage.
      algorithm_config: dict
          Configuration of the algorithm.
      locked: int
          Whether algorithm is locked (1) or not (0, default).
      state: dict, optional
          Optional algorithm state.
      heartbeat: datetime, optional
          Algorithm heartbeat. Default to datetime.utcnow().
      """
      raise NotImplementedError()
  
imports: from __future__ import annotations
  import contextlib
  import copy
  import logging
  import typing
  from datetime import datetime
  from typing import Literal
  import orion.core
  from orion.core.io import resolve_config
  from orion.core.utils import GenericFactory
label_desc: Use image node_id 25 for calling the BaseStorageProtocol obj's underlying member method code with example usage: obj.write_algorithm_lock(experiment_id, algorithm_config, locked, state, heartbeat) without return types