code: def change_marginal_mixture_size(op, dist, new_size, expand=False):
      weights, *components = dist.owner.inputs[1:]
  
      if expand:
          component = components[0]
          # Old size is equal to `shape[:-ndim_supp]`, with care needed for `ndim_supp == 0`
          size_dims = component.ndim - component.owner.op.ndim_supp
          if len(components) == 1:
              # If we have a single component, new size should ignore the mixture axis
              # dimension, as that is not touched by `_resize_components`
              size_dims -= 1
          old_size = components[0].shape[:size_dims]
          new_size = tuple(new_size) + tuple(old_size)
  
      return Mixture.rv_op(weights, *components, size=new_size)
  
imports: import warnings
  import numpy
  import pytensor
  import pytensor.tensor
  from pytensor.graph.basic import Node, equal_computations
  from pytensor.tensor import TensorVariable
  from pytensor.tensor.random.op import RandomVariable
  from pymc.distributions import transforms
  from pymc.distributions.continuous import Gamma, LogNormal, Normal, get_tau_sigma
  from pymc.distributions.discrete import Binomial, NegativeBinomial, Poisson
  from pymc.distributions.dist_math import check_parameters
  from pymc.distributions.distribution import DiracDelta, Distribution, SymbolicRandomVariable, _moment, moment
  from pymc.distributions.shape_utils import _change_dist_size, change_dist_size
  from pymc.distributions.transforms import _default_transform
  from pymc.distributions.truncated import Truncated
  from pymc.logprob.abstract import _logcdf, _logcdf_helper, _logprob
  from pymc.logprob.basic import logp
  from pymc.logprob.transforms import IntervalTransform
  from pymc.pytensorf import floatX
  from pymc.util import check_dist_not_registered
  from pymc.vartypes import continuous_types, discrete_types
label_desc: Use image node_id 1 for calling a global function with example usage: change_marginal_mixture_size(op, dist, new_size, expand) and returns: Mixture