def add_summary(self, summary, global_step=None):
if isinstance(summary, bytes):<EOL><INDENT>summ = summary_pb2.Summary()<EOL>summ.ParseFromString(summary)<EOL>summary = summ<EOL><DEDENT>for value in summary.value:<EOL><INDENT>if not value.metadata:<EOL><INDENT>continue<EOL><DEDENT>if value.tag in self._seen_summary_tags:<EOL><INDENT>value.ClearField("<STR_LIT>")<EOL>continue<EOL><DEDENT>self._seen_summary_tags.add(value.tag)<EOL><DEDENT>event = event_pb2.Event(summary=summary)<EOL>self._add_event(event, global_step)<EOL>
Adds a `Summary` protocol buffer to the event file.
        This method wraps the provided summary in an `Event` protocol buffer and adds it
        to the event file.

        Parameters
        ----------
          summary : A `Summary` protocol buffer
              Optionally serialized as a string.
          global_step: Number
              Optional global step value to record with the summary.