human
4. A Pure Python class to exercise the AXI IIC Controller inheriting from PMOD_IIC
This class is ported from http://www.seeedstudio.com/wiki/Grove_-_Temperature_Sensor.
 Write me a the Python program you requested?
assistant
#Here is the Python program you requested.
from time import sleep
from math import log
from pynq.iop import PMOD_GROVE_G3
from pynq.iop import PMOD_GROVE_G4
from pynq.iop.pmod_iic import Pmod_IIC

class Python_Grove_TMP(Pmod_IIC):
    """This class controls the grove temperature sensor.
    
    This class inherits from the PMODIIC class.
    
    Attributes
    ----------
    iop : _IOP
        The _IOP object returned from the DevMode.
    scl_pin : int
        The SCL pin number.
    sda_pin : int
        The SDA pin number.
    iic_addr : int
        The IIC device address.
    
    """
    def __init__(self, pmod_id, gr_pins, model = 'v1.2'): 
        """Return a new instance of a grove OLED object. 
        
        Parameters
        ----------
        pmod_id : int
            The PMOD ID (1, 2) corresponding to (PMODA, PMODB).
        gr_pins: list
            The group pins on Grove Adapter. G3 or G4 is valid.
        model : string
            Temperature sensor model (can be found on the device).
            
        """
        if gr_pins in [PMOD_GROVE_G3, PMOD_GROVE_G4]:
            [scl_pin,sda_pin] = gr_pins
        else:
            raise ValueError("Valid group numbers are G3 and G4.")
            
        # Each revision has its own B value
        if model == 'v1.2':
            # v1.2 uses thermistor NCP18WF104F03RC
            self.bValue = 4250
        elif model == 'v1.1':
            # v1.1 uses thermistor NCP18WF104F03RC
            self.bValue = 4250
        else:
            # v1.0 uses thermistor TTC3A103*39H
            self.bValue = 3975
        
        super().__init__(pmod_id, scl_pin, sda_pin, 0x50)
        
        # Initialize the Grove ADC         
        self.send([0x2,0x20]);   
        
    def read(self):
        """Read temperature in Celsius from grove temperature sensor.
        
        Parameters
        ----------
        None
        
        Returns
        -------
        float
            Temperature reading in Celsius.
        
        """
        val = self._read_grove_adc()
        R =...