code: def to_funsor(
      x, output=None, dim_to_name=None, dim_type=DimType.LOCAL
  ):
      import funsor
  
      if pyro.poutine.runtime.am_i_wrapped() and not dim_to_name:
          dim_to_name = _DIM_STACK.global_frame.dim_to_name.copy()
      assert not dim_to_name or not any(
          isinstance(name, DimRequest) for name in dim_to_name.values()
      )
      return funsor.to_funsor(x, output=output, dim_to_name=dim_to_name)
  
label_desc: Use image node_id 1 for calling a global function with example usage: to_funsor(x, output, dim_to_name, dim_type) and returns: funsor