<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_peripheral(self, power=None, pullup=None, aux=None, chip_select=None):
 """ Set the peripheral config at runtime. If a parameter is None then the config will not be changed. :param power: Set to True to enable the power supply or False to disable :param pullup: Set to True to enable the internal pull-up resistors. False to disable :param aux: Set the AUX pin output state :param chip_select: Set the CS pin output state """

        if power is not None:
            self.power = power
        if pullup is not None:
            self.pullup = pullup
        if aux is not None:
            self.aux = aux
        if chip_select is not None:
            self.chip_select = chip_select
        # Set peripheral status
        peripheral_byte = 64
        if self.chip_select:
            peripheral_byte |= 0x01
        if self.aux:
            peripheral_byte |= 0x02
        if self.pullup:
            peripheral_byte |= 0x04
        if self.power:
            peripheral_byte |= 0x08

        self.device.write(bytearray([peripheral_byte]))
        response = self.device.read(1)
        if response != b"\x01":
            raise Exception("Setting peripheral failed. Received: {}".format(repr(response)))