diff --git a/src/cryptography/utils.py b/src/cryptography/utils.py
--- a/src/cryptography/utils.py
+++ b/src/cryptography/utils.py
@@ -7,6 +7,7 @@
 import enum
 import inspect
 import sys
+import types
 import typing
 import warnings
 
@@ -113,8 +114,9 @@ def __init__(self, value, message, warning_class):
         self.warning_class = warning_class
 
 
-class _ModuleWithDeprecations(object):
+class _ModuleWithDeprecations(types.ModuleType):
     def __init__(self, module):
+        super().__init__(module.__name__)
         self.__dict__["_module"] = module
 
     def __getattr__(self, attr):

diff --git a/tests/test_utils.py b/tests/test_utils.py
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -4,6 +4,7 @@
 
 
 import binascii
+import inspect
 import os
 import textwrap
 
@@ -12,6 +13,7 @@
 import pytest
 
 import cryptography
+import cryptography.utils
 from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
 
 import cryptography_vectors
@@ -4444,3 +4446,13 @@ def test_raises_unsupported_algorithm():
             "An error.", _Reasons.BACKEND_MISSING_INTERFACE
         )
     assert exc_info.type is UnsupportedAlgorithm
+
+
+def test_inspect_deprecated_module():
+    # Check if inspection is supported by _ModuleWithDeprecations.
+    assert isinstance(
+        cryptography.utils, cryptography.utils._ModuleWithDeprecations
+    )
+    source_file = inspect.getsourcefile(cryptography.utils)
+    assert isinstance(source_file, str)
+    assert source_file.endswith("utils.py")

_ModuleWithDeprecations should inherit from types.ModuleType
Steps for reproducing bug:
```python
import inspect
import cryptography.utils
inspect.getsourcefile(cryptography.utils)
```
This will produce the following error:
> TypeError: module, class, method, function, traceback, frame, or code object was expected, got _ModuleWithDeprecations

The fix looks straightforward in cryptography.utils:
```python
class _ModuleWithDeprecations(types.ModuleType):
    def __init__(self, module):
        super().__init__(module.__name__)
        self.__dict__["_module"] = module
```
Used versions:
* ``Python`` 3.8.5
* ``cryptography`` 3.4.7
* ``cffi`` 1.14.0
* ``pip`` 20.2.2
* ``setuptools`` 49.2.1

* ``cryptography`` was installed by conda


tests/test_utils.py::test_load_ed25519_vectors tests/test_utils.py::test_load_cryptrec_vectors_invalid tests/test_utils.py::test_load_nist_vectors tests/test_utils.py::test_check_backend_support_skip tests/test_utils.py::test_load_nist_vectors_with_null_chars tests/test_utils.py::test_check_backend_support_no_skip tests/test_utils.py::test_load_hash_vectors tests/test_utils.py::test_load_hmac_vectors tests/test_utils.py::test_load_vectors_from_file tests/test_utils.py::test_load_cryptrec_vectors tests/test_utils.py::test_load_hotp_vectors tests/test_utils.py::test_load_pkcs1_vectors tests/test_utils.py::test_load_hash_vectors_bad_data tests/test_utils.py::test_load_nist_gcm_vectors tests/test_utils.py::test_load_totp_vectors tests/test_utils.py::test_load_pkcs1_oaep_vectors tests/test_utils.py::test_load_rsa_nist_vectors tests/test_utils.py::test_load_rsa_nist_pss_verification_vectors tests/test_utils.py::test_load_rsa_nist_pkcs1v15_verification_vectors tests/test_utils.py::test_load_fips_dsa_key_pair_vectors tests/test_utils.py::test_load_fips_ecdsa_key_pair_vectors tests/test_utils.py::test_load_fips_dsa_sig_ver_vectors tests/test_utils.py::test_load_fips_dsa_sig_gen_vectors tests/test_utils.py::test_load_fips_ecdsa_signing_vectors tests/test_utils.py::test_load_kasvs_ecdh_vectors_empty_vector_data tests/test_utils.py::test_load_kasvs_dh_vectors tests/test_utils.py::test_load_kasvs_ecdh_kdf_vectors tests/test_utils.py::test_load_x963_vectors tests/test_utils.py::test_load_kasvs_ecdh_vectors tests/test_utils.py::test_load_kbkdf_vectors tests/test_utils.py::test_vector_version tests/test_utils.py::test_raises_unsupported_algorithm_wrong_type tests/test_utils.py::test_load_nist_ccm_vectors_dvpt tests/test_utils.py::test_load_nist_ccm_vectors_vadt tests/test_utils.py::test_raises_unsupported_algorithm tests/test_utils.py::test_raises_unsupported_algorithm_wrong_reason tests/test_utils.py::test_raises_unsupported_no_exc
tests/test_utils.py::test_inspect_deprecated_module