def serialize(instance):
    """
    Helper function to serialize a tf.train.Example in the beam pipeline

    :param instance: the input, tf.train.Example
    :return: serialized version of the input
    """
    return instance.SerializeToString(deterministic=True)