fix: use 'int.to_bytes' and 'int.from_bytes' for py3 (#904)
diff --git a/google/auth/_helpers.py b/google/auth/_helpers.py
index b239fcd..1b08ab8 100644
--- a/google/auth/_helpers.py
+++ b/google/auth/_helpers.py
@@ -17,6 +17,7 @@
import base64
import calendar
import datetime
+import sys
import six
from six.moves import urllib
@@ -233,3 +234,12 @@
Union[str|bytes]: The encoded value
"""
return base64.urlsafe_b64encode(value).rstrip(b"=")
+
+
+def is_python_3():
+ """Check if the Python interpreter is Python 2 or 3.
+
+ Returns:
+ bool: True if the Python interpreter is Python 3 and False otherwise.
+ """
+ return sys.version_info > (3, 0)