code: def GetSourceWriter(
      source_metadata: event_pb2.SourceMetadata,
  ) -> Optional[str]:
      """Gets the source writer name from the source metadata proto."""
      writer_name = source_metadata.writer
      if not writer_name:
          return None
      # Checks the length of the writer name.
      if len(writer_name) > _MAX_WRITER_NAME_LEN:
          logger.error(
              "Source writer name `%s` is too long, maximum allowed length is %d.",
              writer_name,
              _MAX_WRITER_NAME_LEN,
          )
          return None
      return writer_name
  
imports: from typing import Optional
  from tensorboard.compat.proto import event_pb2
  from tensorboard.util import tb_logging
label_desc: Use image node_id 2 for calling a global function with example usage: GetSourceWriter(source_metadata) and returns: writer_name, None, None