<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write(self, tid, data, offset, fh):
 """ Write operation. Applicable only for control files - updateResults is called. Parameters tid : str Path to file. Original `path` argument is converted to tuple identifier by ``_pathdec`` decorator. data : bytes Ignored. offset : int Ignored. fh : int File descriptor. Returns ------- int Length of data written. """


        if tid[1] == " next":
            d = True
        elif tid[1] == " prev":
            d = False
        else:
            raise FuseOSError(errno.EPERM)

        try:
            self.searches[tid[0]].updateResults(d)
        except KeyError:
            raise FuseOSError(errno.EINVAL) # sth went wrong...
        except ConnectionError:
            raise FuseOSError(errno.ENETDOWN)

        return len(data)