cros_build_lib: Add root user check helpers

Add helper functions, to check root privilege for the user.

BUG=b:218521368
TEST=run_tests lib/ scripts/ service/ cli/

Change-Id: Idd0ad8be3764b323b140d3e334399eef4d21e8a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3491293
Tested-by: Ram Chandrasekar <rchandrasekar@google.com>
Auto-Submit: Ram Chandrasekar <rchandrasekar@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Ram Chandrasekar <rchandrasekar@google.com>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index a904337..715dca1 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -628,7 +628,7 @@
   Also unshare the mount namespace so as to ensure that processes outside
   the chroot can't mess with our mounts.
   """
-  if os.geteuid() != 0:
+  if osutils.IsNonRootUser():
     # Make sure to preserve the active Python executable in case the version
     # we're running as is not the default one found via the (new) $PATH.
     cmd = _SudoCommand() + ['--'] + [sys.executable] + argv