code: def get_uid(
      item: Experiment | Trial | None = None,
      uid: str | int | None = None,
      force_uid: bool = True,
  ):
      """Return uid either from `item` or directly uid.
  
      Parameters
      ----------
      item: Experiment or Trial, optional
         Object with .id attribute
  
      uid: str or int, optional
          str id representation
  
      force_uid: bool, optional
          If True, at least one of item or uid must be passed.
  
      Raises
      ------
      UndefinedCall
          if both item and uid are not set and force_uid is True
  
      AssertionError
          if both item and uid are provided and they do not match
      """
      if item is not None and uid is not None:
          assert item.id == uid
  
      if uid is None:
          if item is None and force_uid:
              raise MissingArguments(
                  "Either `item` or `uid` should be set"
              )
          elif item is not None:
              return item.id
  
      return uid
  
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 1 for calling a global function with example usage: get_uid(item, uid, force_uid) and returns: uid, item