code: def test_snappy_detect_xerial():
      import kafka as kafka1
  
      _detect_xerial_stream = kafka1.codec._detect_xerial_stream
  
      header = b"\x82SNAPPY\x00\x00\x00\x00\x01\x00\x00\x00\x01Some extra bytes"
      false_header = b"\x01SNAPPY\x00\x00\x00\x01\x00\x00\x00\x01"
      default_snappy = snappy_encode(b"foobar" * 50)
      random_snappy = snappy_encode(
          b"SNAPPY" * 50, xerial_compatible=False
      )
      short_data = b"\x01\x02\x03\x04"
  
      assert _detect_xerial_stream(header) is True
      assert _detect_xerial_stream(b"") is False
      assert _detect_xerial_stream(b"\x00") is False
      assert _detect_xerial_stream(false_header) is False
      assert _detect_xerial_stream(default_snappy) is True
      assert _detect_xerial_stream(random_snappy) is False
      assert _detect_xerial_stream(short_data) is False
  
file_path: kafka-python/test/test_codec.py
imports: from __future__ import absolute_import
  import platform
  import struct
  import pytest
  from kafka.vendor.six.moves import range
  from kafka.codec import has_snappy, has_lz4, has_zstd, gzip_encode, gzip_decode, snappy_encode, snappy_decode, lz4_encode, lz4_decode, lz4_encode_old_kafka, lz4_decode_old_kafka, zstd_encode, zstd_decode
  from test.testutil import random_string
label_desc: Use image node_id 3 for calling a global function with example usage: test_snappy_detect_xerial() without return types