<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def pb(name, data, display_name=None, description=None):
 """Create a legacy text summary protobuf. Arguments: name: A name for the generated node. Will also serve as a series name in TensorBoard. data: A Python bytestring (of type bytes), or Unicode string. Or a numpy data array of those types. display_name: Optional name for this summary in TensorBoard, as a `str`. Defaults to `name`. description: Optional long-form description for this summary, as a `str`. Markdown is supported. Defaults to empty. Raises: ValueError: If the type of the data is unsupported. Returns: A `tf.Summary` protobuf object. """

  # TODO(nickfelt): remove on-demand imports once dep situation is fixed.
  import tensorflow.compat.v1 as tf

  try:
    tensor = tf.make_tensor_proto(data, dtype=tf.string)
  except TypeError as e:
    raise ValueError(e)

  if display_name is None:
    display_name = name
  summary_metadata = metadata.create_summary_metadata(
      display_name=display_name, description=description)
  tf_summary_metadata = tf.SummaryMetadata.FromString(
      summary_metadata.SerializeToString())
  summary = tf.Summary()
  summary.value.add(tag='%s/text_summary' % name,
                    metadata=tf_summary_metadata,
                    tensor=tensor)
  return summary