code: def multinomial(n, pvals, size=None):
      assert not ivy.exists(size) or (len(size) > 0 and len(size) < 3)
      batch_size = 1
      if ivy.exists(size):
          if len(size) == 2:
              batch_size = size[0]
              num_samples = size[1]
          else:
              num_samples = size[0]
      else:
          num_samples = len(pvals)
      return ivy.multinomial(
          n, num_samples, batch_size=batch_size, probs=pvals
      )
  
imports: import ivy
  from ivy.functional.frontends.numpy.func_wrapper import to_ivy_arrays_and_back, from_zero_dim_arrays_to_scalar
  from ivy import with_supported_dtypes
label_desc: Use image node_id 15 for calling a global function with example usage: multinomial(n, pvals, size) and returns: ivy