<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def datasets(self):
 """Return a dictionnary describing all the file datasets. Args:: no argument Returns:: Empty dictionnary if no dataset is defined. Otherwise, dictionnary whose keys are the file dataset names, and values are tuples describing the corresponding datasets. Each tuple holds the following elements in order: - tuple holding the names of the dimensions defining the dataset coordinate axes - tuple holding the dataset shape (dimension lengths); if a dimension is unlimited, the reported length corresponds to the dimension current length - dataset type - dataset index number C library equivalent : no equivalent """

        # Get number of datasets
        nDs = self.info()[0]

        # Inquire each var
        res = {}
        for n in range(nDs):
            # Get dataset info.
            v = self.select(n)
            vName, vRank, vLen, vType, vAtt = v.info()
            if vRank < 2:     # need a sequence
                vLen = [vLen]
            # Get dimension info.
            dimNames = []
            dimLengths = []
            for dimNum in range(vRank):
                d = v.dim(dimNum)
                dimNames.append(d.info()[0])
                dimLengths.append(vLen[dimNum])
            res[vName] = (tuple(dimNames), tuple(dimLengths),
                         vType, n)

        return res