<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def focusd(task):
 """ Forks the current process as a daemon to run a task. `task` ``Task`` instance for the task to run. """


    # determine if command server should be started
    if registration.get_registered(event_hooks=True, root_access=True):
        # root event plugins available
        start_cmd_srv = (os.getuid() == 0)  # must be root
    else:
        start_cmd_srv = False

    # daemonize our current process
    _run = lambda: Focusd(task).run(start_cmd_srv)
    daemonize(get_daemon_pidfile(task), task.task_dir, _run)