code: def _read_serial(self, may_block):
          
  
          frame = yubikey_frame.YubiKeyFrame(command = SLOT.DEVICE_SERIAL)
          self._device._write(frame)
          response = self._device._read_response(may_block=may_block)
          if not yubico_util.validate_crc16(response[:6]):
              raise YubiKeyUSBHIDError("Read from device failed CRC check")
          # the serial number is big-endian, although everything else is little-endian
          serial = struct.unpack('>lxxx', response)
          return serial[0]
docs: Read the serial number from a YubiKey > 2.2.