code: def _castable_namedtuple(typename, field_names):
      base = namedtuple("%s_base" % typename, field_names)
  
      def new_new(cls, *args, **kwargs):
          if (
              not kwargs
              and len(args) == 1
              and isinstance(args, Sequence)
          ):
              return base.__new__(cls, *args[0], **kwargs)
          return base.__new__(cls, *args, **kwargs)
  
      return type(typename, (base,), {"__new__": new_new})
  
imports: from collections import namedtuple
  from collections.abc import Sequence
  import numbers
  import math
  import re
  import warnings
  from traitlets import Unicode, Int, CInt, Instance, Enum, List, Dict, Float, CFloat, Bool, Tuple, Undefined, TraitError, Union, TraitType, CaselessStrEnum
  from ipywidgets import widget_serialization
  from ipydatawidgets import DataUnion, NDArrayWidget, shape_constraints
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: _castable_namedtuple(typename, field_names) and returns: type, base, base