human
I wrote the below code

    def adjust_temp(pi_pdf, temp):
        pi_pdf = (np.log(pi_pdf) / temp)
        pi_pdf -= pi_pdf.max()
        pi_pdf = np.exp(pi_pdf)
        pi_pdf /= pi_pdf.sum()
        return pi_pdf
    def get_pi_idx(x, pdf, temp=1.0, greedy=False):
        'Samples    from    a    pdf,    optionally    greedily.'
        if greedy:
            return np.argmax(pdf)
        pdf = adjust_temp(np.copy(pdf), temp)
        accumulate = 0
        for i in range(0, pdf.size):
            accumulate += pdf[i]
            if (accumulate >= x):
                return i
        tf.logging.info('Error    with    sampling    ensemble.')
        return (-1)
    def sample_gaussian_2d(mu1, mu2, s1, s2, rho, temp=1.0, greedy=False):
        if greedy:
            return (mu1, mu2)
        mean = [mu1, mu2]
        s1 *= (temp * temp)
        s2 *= (temp * temp)
        cov = [[(s1 * s1), ((rho * s1) * s2)], [((rho * s1) * s2), (s2 * s2)]]
        x = np.random.multivariate_normal(mean, cov, 1)
        return (x[0][0], x[0][1])
    prev_x = np.zeros((1, 1, 5), dtype=np.float32)
    prev_x[(0, 0, 2)] = 1
    if (z is None):
        z = np.random.randn(1, model.hps.z_size)
    if (not model.hps.conditional):
        prev_state = sess.run(model.initial_state)
    else:
        prev_state = sess.run(model.initial_state, feed_dict={model.batch_z: z})
    strokes = np.zeros((seq_len, 5), dtype=np.float32)
    mixture_params = []
    greedy = False
    temp = 1.0
    for i in range(seq_len):
        if (not model.hps.conditional):
            feed = {model.input_x: prev_x, model.sequence_lengths: [1], model.initial_state: prev_state}
        else:
            feed = {model.input_x: prev_x, model.sequence_lengths: [1], model.initial_state: prev_state, model.batch_z: z}
        params = sess.run([model.pi, model.mu1, model.mu2, model.sigma1, model.sigma2, model.corr, model.pen, model.final_state], feed)
        [o_pi, o_mu1, o_mu2, o_sigma1, o_sigma2, o_corr, o_pen, next_state] = params
        if (i < 0):
            greedy = False
      ...

What's a good function header?
assistant
#Here's a good function header.

def sample(sess, model, seq_len=250, temperature=1.0, greedy_mode=False, z=None):