docs: def unpack(data):
      """
      returns either a BufferUnpacker or StreamUnpacker instance,
      depending upon the type of data. The unpacker supports the managed
      context interface, so may be used eg: `with unpack(my_data) as
      unpacker:`
      """
  
      if isinstance(data, (bytes, buffer)):
          return BufferUnpacker(data)
  
      elif hasattr(data, "read"):
          return StreamUnpacker(data)
  
      else:
          raise TypeError("unpack requires bytes, buffer, or instance"
                          " supporting the read method")