'Create the lock file and write the PID in it. We also create the directory structure since the ProcessChecker
might be called before the .Tribler directory has been created.'

def create_lock_file(self):

    if (not os.path.exists(self.state_directory)):
        os.makedirs(self.state_directory)
    with open(self.lock_file_path, 'wb') as lock_file:
        lock_file.write(str(os.getpid()))
