<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def exit_actor():
 """Intentionally exit the current actor. This function is used to disconnect an actor and exit the worker. Raises: Exception: An exception is raised if this is a driver or this worker is not an actor. """

    worker = ray.worker.global_worker
    if worker.mode == ray.WORKER_MODE and not worker.actor_id.is_nil():
        # Disconnect the worker from the raylet. The point of
        # this is so that when the worker kills itself below, the
        # raylet won't push an error message to the driver.
        worker.raylet_client.disconnect()
        ray.disconnect()
        # Disconnect global state from GCS.
        ray.global_state.disconnect()
        sys.exit(0)
        assert False, "This process should have terminated."
    else:
        raise Exception("exit_actor called on a non-actor worker.")