Issue #15167 (as part of #13959): imp.get_magic() is no implemented in
Lib/imp.py.
diff --git a/Lib/imp.py b/Lib/imp.py
index dab8312..58d1c97 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -10,12 +10,12 @@
                   load_dynamic, get_frozen_object, is_frozen_package,
                   init_builtin, init_frozen, is_builtin, is_frozen,
                   _fix_co_filename, extension_suffixes)
-# Could move out of _imp, but not worth the code
-from _imp import get_magic
 
+# Directly exposed by this module
 from importlib._bootstrap import new_module
 from importlib._bootstrap import cache_from_source
 
+
 from importlib import _bootstrap
 from importlib import machinery
 import os
@@ -37,6 +37,11 @@
 IMP_HOOK = 9
 
 
+def get_magic():
+    """Return the magic number for .pyc or .pyo files."""
+    return _bootstrap._MAGIC_BYTES
+
+
 def get_tag():
     """Return the magic tag for .pyc or .pyo files."""
     return sys.implementation.cache_tag