human
I wrote the below code

    def flatten_unpadded_sequences():
        return tf.reshape(maybe_padded_sequences, ([(-1)] + maybe_padded_sequences.shape.as_list()[2:]))
    if (lengths is None):
        return flatten_unpadded_sequences()
    def flatten_padded_sequences():
        indices = tf.where(tf.sequence_mask(lengths))
        return tf.gather_nd(maybe_padded_sequences, indices)
    return tf.cond(tf.equal(tf.reduce_min(lengths), tf.shape(maybe_padded_sequences)[1]), flatten_unpadded_sequences, flatten_padded_sequences)

What's a good function header?

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

def flatten_maybe_padded_sequences(maybe_padded_sequences, lengths=None):