code: def _ensure_vec4_func(dims):
      if dims == 2:
          func = Function(
              """
                  vec4 vec2to4(vec2 xyz) {
                      return vec4(xyz, 0.0, 1.0);
                  }
              """
          )
      elif dims == 3:
          func = Function(
              """
                  vec4 vec3to4(vec3 xyz) {
                      return vec4(xyz, 1.0);
                  }
              """
          )
      else:
          raise TypeError(
              "Vertex data must have shape (...,2) or (...,3)."
          )
      return func
  
imports: from __future__ import division
  from functools import lru_cache
  import numpy
  from ...None import gloo, glsl
  from ...color import Color, ColorArray, get_colormap
  from ..shaders import Function
  from ..visual import Visual, CompoundVisual
  from ...util.profiler import Profiler
  from .dash_atlas import DashAtlas
label_desc: Use image node_id 2 for calling the _GLLineVisual obj's underlying member method code with example usage: obj._ensure_vec4_func(dims) and returns: func