code: def tagged_key(key: str, tag: str) -> str:
      """Returns a base key tagged with a user defined tag.
  
      The tag is inserted after the base key's initial prefix.
  
      Example: tagged_key('a/c', 'b') -> 'a/b/c'
      Example: tagged_key('a', 'b') -> 'a/b'  # Use case for plots keys.
  
      Args:
        key: Base key.
        tag: Tag to add to base key.
      """
      parts = key.split("/")
      if len(parts) > 1:
          return "%s/%s/%s" % (parts[0], tag, "/".join(parts[1:]))
      return "%s/%s" % (key, tag)
  
imports: from typing import Optional
label_desc: Use image node_id 2 for calling a global function with example usage: tagged_key(key, tag) and returns: unknown, unknown