<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dim(self, dim_index):
 """Get an SDim instance given a dimension index number. Args:: dim_index index number of the dimension (numbering starts at 0) C library equivalent : SDgetdimid """

        id = _C.SDgetdimid(self._id, dim_index)
        _checkErr('dim', id, 'invalid SDS identifier or dimension index')
        return SDim(self, id, dim_index)