<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def setfillmode(self, fill_mode):
 """Set the fill mode for all the datasets in the file. Args:: fill_mode : fill mode; one of : SDC.FILL write the fill value to all the datasets of the file by default SDC.NOFILL do not write fill values to all datasets of the file by default Returns:: previous fill mode value C library equivalent: SDsetfillmode """


        if not fill_mode in [SDC.FILL, SDC.NOFILL]:
            raise HDF4Error("bad fill mode")
        old_mode = _C.SDsetfillmode(self._id, fill_mode)
        _checkErr('setfillmode', old_mode, 'cannot execute')
        return old_mode