<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run_summaries( sess, merged_summaries, summary_writer, epoch, feed, tens):
 """Run the summaries and error computation on the validation set. Parameters sess : tf.Session Tensorflow session object. merged_summaries : tf obj Tensorflow merged summaries obj. summary_writer : tf.summary.FileWriter Tensorflow summary writer obj. epoch : int Current training epoch. feed : dict Validation feed dict. tens : tf.Tensor Tensor to display and evaluate during training. Can be self.accuracy for SupervisedModel or self.cost for UnsupervisedModel. Returns ------- err : float, mean error over the validation set. """

    try:
        result = sess.run([merged_summaries, tens], feed_dict=feed)
        summary_str = result[0]
        out = result[1]
        summary_writer.add_summary(summary_str, epoch)
    except tf.errors.InvalidArgumentError:
        out = sess.run(tens, feed_dict=feed)

    return out