code: def bytes_available(device):
      
      bytes_avail = 0
  
      if isinstance(device, alarmdecoder.devices.SerialDevice):
          if hasattr(device._device, "in_waiting"):
              bytes_avail = device._device.in_waiting
          else:
              bytes_avail = device._device.inWaiting()
      elif isinstance(device, alarmdecoder.devices.SocketDevice):
          bytes_avail = 4096
  
      return bytes_avail
docs: Determines the number of bytes available for reading from an
      AlarmDecoder device
  
      :param device: the AlarmDecoder device
      :type device: :py:class:`~alarmdecoder.devices.Device`
  
      :returns: int