class_docstr: S3Payload class
class_docstr_tok: ["S3Payload","class"]
code: def _gz_reader(open_file):
      open_file.seek(0)
      reader = gzip.GzipFile(fileobj=open_file, mode="r")
      try:
          # Test to ensure this is gzip data, then rewind
          reader.read(1)
          reader.rewind()
      except IOError:
          # Fall back on the default reader
          reader = open_file
          reader.seek(0)
  
      # Return either the gzip reader or the original reader
      return reader
  
imports: import json
  import logging
  import urllib.request
  import urllib.parse
  import urllib.error
  import gzip
  import os
  import tempfile
  import subprocess
  import time
  import boto3
  from botocore.exceptions import ClientError
  import jsonlines
  from streamalert.classifier.payload.payload_base import PayloadRecord, RegisterInput, StreamPayload
  from streamalert.shared import CLASSIFIER_FUNCTION_NAME
  from streamalert.shared.logger import get_logger
  from streamalert.shared.metrics import MetricLogger
label_desc: Use image node_id 10 for calling the S3Payload obj's underlying member method code with example usage: obj._gz_reader(open_file) and returns: reader