Fixes #4076 - simplify the implementation of int_from_bytes on python2 (#4077)

* Fixes #4076 - simplify the implementation of int_from_bytes on python2

* whitespace

* Added a test
diff --git a/tests/test_cryptography_utils.py b/tests/test_cryptography_utils.py
index 320f7aa..ddea760 100644
--- a/tests/test_cryptography_utils.py
+++ b/tests/test_cryptography_utils.py
@@ -11,6 +11,8 @@
 
 def test_int_from_bytes_bytearray():
     assert utils.int_from_bytes(bytearray(b"\x02\x10"), "big") == 528
+    with pytest.raises(TypeError):
+        utils.int_from_bytes(["list", "is", "not", "bytes"], "big")
 
 
 class TestCachedProperty(object):