sudo works by writing your own version in Python!
One might think that
sudois actually some binary deeply integrated into the kernel, relying on a special purpose-built system call to achieve its functionality. After all, it lets you use
rootwithout even providing the password for that account! But thanks to one bit inside file permissions,
sudocan exist without any of this.