docstr: Accept scaler val, (y,), (x, y), (label, y), (x, y, label), return (x, y, z, color, label)
          
docstr_tok: ["Accept","scaler","val",",","(","y",",",")",",","(","x",",","y",")",",","(","label",",","y",")",",","(","x",",","y",",","label",")",",","return","(","x",",","y",",","z",",","color",",","label",")"]
code: def _val2tuple(val, x) -> tuple:
      """Accept scaler val, (y,), (x, y), (label, y), (x, y, label), return (x, y, z, color, label)"""
      if utils.is_array_like(val):
          unpacker = lambda a0=None, a1=None, a2=None, *_: (a0, a1, a2)
          t = unpacker(*val)
          if len(t) == 1:  # (y,)
              t = (x, t[0], 0, None, None)
          elif len(t) == 2:
              t = (
                  (x, t[1], 0, None, t[0])
                  if isinstance(t[0], str)
                  else t + (None,)
              )
          elif len(t) == 3:  # either (x, y, z) or (x, y, label)
              t = (
                  (t[0], t[1], None, t[2])
                  if isinstance(t[2], str)
                  else t + (None, None)
              )
          elif len(t) == 4:  # we assume (x, y, z, color)
              t += (None,)
          # else leave it alone
      else:  # scaler
          t = (x, val, 0, None, None)
  
      return t
  
file_path: tensorwatch/tensorwatch/mpl/bar_plot.py
imports: from .base_mpl_plot import BaseMplPlot
  from ..None import utils
  from ..None import image_utils
  import numpy
  from itertools import groupby
  import operator
label_desc: Use image node_id 5 for calling the BarPlot obj's underlying member method code with example usage: obj._val2tuple(val, x) and returns: t