code: def image_id(image_name: str) -> Optional[str]:
      """Retreve the image id from the local docker daemon or remote registry."""
      if "@sha256:" in image_name:
          return image_name
      else:
          digests = shell(
              [
                  "inspect",
                  image_name,
                  "--format",
                  "{{json .RepoDigests}}",
              ]
          )
          try:
              if digests is None:
                  raise ValueError
              im_id: str = json.loads(digests)[0]
              return im_id
          except (ValueError, IndexError):
              return image_id_from_registry(image_name)
  
imports: import json
  import logging
  import os
  import subprocess
  from typing import Any, Dict, List, Optional, Tuple, Union
  import requests
  from dockerpycreds.utils import find_executable
  from wandb.docker import auth, www_authenticate
  from wandb.errors import Error
label_desc: Use image node_id 14 for calling a global function with example usage: image_id(image_name) and returns: image_name, im_id, image_id_from_registry