code: def transform(node, ctx, default_to_null_return=True):
      """Ensure a function has only a single return, at the end."""
      node = qual_names.resolve(node)
      node = activity.resolve(node, ctx, None)
  
      # Note: Technically, these two could be merged into a single walk, but
      # keeping them separate helps with readability.
      node = ConditionalReturnRewriter(ctx).visit(node)
  
      node = qual_names.resolve(node)
      node = activity.resolve(node, ctx, None)
      transformer = ReturnStatementsTransformer(
          ctx, allow_missing_return=default_to_null_return
      )
      node = transformer.visit(node)
      return node
  
imports: import gast
  from nvidia.dali._autograph.core import converter
  from nvidia.dali._autograph.pyct import anno
  from nvidia.dali._autograph.pyct import parser
  from nvidia.dali._autograph.pyct import qual_names
  from nvidia.dali._autograph.pyct import templates
  from nvidia.dali._autograph.pyct.static_analysis import activity
  from nvidia.dali._autograph.pyct.static_analysis.annos import NodeAnno
label_desc: Use image node_id 1 for calling a global function with example usage: transform(node, ctx, default_to_null_return) and returns: node