code: def product(parameter):
      # TODO(niboshi): Add documentation
      if isinstance(parameter, dict):
          return product_dict(
              *[
                  _values_to_dicts(names, values)
                  for names, values in sorted(parameter.items())
              ]
          )
  
      elif isinstance(parameter, list):
          # list of lists of dicts
          if not all(isinstance(_, list) for _ in parameter):
              raise TypeError(
                  "parameter must be list of lists of dicts"
              )
          if not all(isinstance(_, dict) for l in parameter for _ in l):
              raise TypeError(
                  "parameter must be list of lists of dicts"
              )
          return product_dict(*parameter)
  
      else:
          raise TypeError(
              "parameter must be either dict or list. Actual: {}".format(
                  type(parameter)
              )
          )
  
imports: import functools
  import itertools
  import types
  import typing
  import unittest
  import numpy
  import six
  from chainer.testing import _bundle
  from chainer import utils
label_desc: Use image node_id 10 for calling a global function with example usage: product(parameter) and returns: product_dict, product_dict