def _set_max_speed(self, max_speed):
        if not isinstance(max_speed, int) and not isinstance(max_speed, float):
            raise TypeError("Invalid max_speed type, should be integer or float.")

        # Set max speed
        buf = array.array('I', [int(max_speed)])
        try:
            fcntl.ioctl(self._fd, SPI._SPI_IOC_WR_MAX_SPEED_HZ, buf, False)
        except __HOLE__ as e:
            raise SPIError(e.errno, "Setting SPI max speed: " + e.strerror)
dataset/ETHPy150Open vsergeev/python-periphery/periphery/spi.py/SPI._set_max_speed