def release_lock(self, verbose=VERBOSE, raiseError=RAISE_ERROR):
        if not os.path.isfile(self.__lockPath):
            released = True
            code     = 0
        else:
            try:
                with open(self.__lockPath, 'rb') as fd:
                    lock = fd.readlines()
            except Exception as err:
                code     = Exception( "Unable to read release lock file '%s' (%s)"%(self.__lockPath,str(err)) )
                released = False
                if verbose: print(str(code))
                if raiseError: raise code
            else:
                if not len(lock):
                    code     = 1
                    released = True
                elif lock[0].rstrip() == self.__lockPass.encode():
                    try:
                        with open(self.__lockPath, 'wb') as f:
                            f.write( ''.encode() )
                            f.flush()
                            os.fsync(f.fileno())
                    except Exception as err:
                        released = False
                        code     = Exception( "Unable to write release lock file '%s' (%s)"%(self.__lockPath,str(err)) )
                        if verbose: print(str(code))
                        if raiseError: raise code
                    else:
                        released = True
                        code     = 2
                else:
                    code     = 4
                    released = False
        if released and self.__fd is not None:
            try:
                if not self.__fd.closed:
                    self.__fd.flush()
                    os.fsync(self.__fd.fileno())
                    self.__fd.close()
            except Exception as err:
                code = Exception( "Unable to close file descriptor of locked file '%s' (%s)"%(self.__filePath,str(err)) )
                if verbose: print(str(code))
                if raiseError: raise code
            else:
                code = 3
        return released, code