Backport of PEP 562
copied from cf-staging / pep562A backport of PEP 562. Allows controlling a module's dir and getattr. Useful for deprecating attributes. Works for Python 2.7+. And while it works on Python 3.7, it is recommended to use the official Python 3.7 implementation where applicable.
This module can be installed and used as a dependency, or if desired, it is easy to vendor as the license is quite permissible, and the code is contained in a single file.
Once Python 3.6 is end of life, this module will be irrelevant and will no longer receive active support.