human
Complete this python program:
def _elbo_t(logp, uw_g, uw_l, inarray_g, inarray_l, c_g, c_l, n_mcsamples, random_seed):
assistant
#Here is the Python program you requested.

    """Return expression of approximate ELBO based on Monte Carlo sampling.
    """
    if (random_seed is None):
        r = MRG_RandomStreams(gen_random_state())
    else:
        r = MRG_RandomStreams(seed=random_seed)
    normal_const = floatX((1 + np.log((2.0 * np.pi))))
    elbo = 0
    if (uw_l is not None):
        l_l = (uw_l.size / 2).astype('int32')
        u_l = uw_l[:l_l]
        w_l = uw_l[l_l:]
        ns_l = r.normal(size=(n_mcsamples, inarray_l.tag.test_value.shape[0]))
        zs_l = ((ns_l * tt.exp(w_l)) + u_l)
        elbo += tt.sum((c_l * (w_l + (0.5 * normal_const))))
    else:
        zs_l = None
    if (uw_g is not None):
        l_g = (uw_g.size / 2).astype('int32')
        u_g = uw_g[:l_g]
        w_g = uw_g[l_g:]
        ns_g = r.normal(size=(n_mcsamples, inarray_g.tag.test_value.shape[0]))
        zs_g = ((ns_g * tt.exp(w_g)) + u_g)
        elbo += tt.sum((c_g * (w_g + (0.5 * normal_const))))
    else:
        zs_g = None
    if ((zs_l is not None) and (zs_g is not None)):
        def logp_(z_g, z_l):
            return theano.clone(logp, OrderedDict({inarray_g: z_g, inarray_l: z_l}), strict=False)
        sequences = [zs_g, zs_l]
    elif (zs_l is not None):
        def logp_(z_l):
            return theano.clone(logp, OrderedDict({inarray_l: z_l}), strict=False)
        sequences = [zs_l]
    else:
        def logp_(z_g):
            return theano.clone(logp, OrderedDict({inarray_g: z_g}), strict=False)
        sequences = [zs_g]
    (logps, _) = theano.scan(fn=logp_, outputs_info=None, sequences=sequences)
    elbo += tt.mean(logps)
    return elbo