code: def as_ivy_dev(device: str, /):
      if isinstance(device, str) and "/" not in device:
          return ivy.Device(device)
      dev_in_split = device[1:].split(":")[-2:]
      if len(dev_in_split) == 1:
          return ivy.Device(dev_in_split[0])
      dev_type, dev_idx = dev_in_split
      dev_type = dev_type.lower()
      if dev_type == "cpu":
          return ivy.Device(dev_type)
      return ivy.Device(f"{dev_type}:{dev_idx}")
  
imports: import tensorflow
  from typing import Union, Optional
  import ivy
  from ivy.functional.ivy.device import Profiler
label_desc: Use image node_id 4 for calling a global function with example usage: as_ivy_dev() and returns: ivy, ivy, ivy, ivy