code: def records_iter(fh, buffer_size=1024 * 1024 * 16):
      
      buf = None
      while True:
          chunk = fh.read(buffer_size)
          if not chunk:
              if buf:
                  yield json.loads(buf)
              return
          if buf:
              chunk = b"%s%s" % (buf, chunk)
              buf = None
          while chunk:
              idx = chunk.find(b'}{')
              if idx == -1:
                  buf = chunk
                  chunk = None
                  continue
              record = chunk[:idx + 1]
              yield json.loads(record)
              chunk = chunk[idx + 1:]
docs: Split up a firehose s3 object into records
  
      Firehose cloudwatch log delivery of flow logs does not delimit
      record boundaries. We have to use knowledge of content to split
      the records on boundaries. In the context of flow logs we're
      dealing with delimited records.