When creating a python package there are often instances where you want to integrate with other third-party packages. For example if you are creating an ORM package like sqlalchemy you may want integrations with different databases, but you may not want to take a direct dependency in your own package.
To check for the presence of the third-party package without taking it
as a dependency the following decorator
pattern can be used to perform the
checks.
Then from your individual methods or classes you can use this decorator and import the specific module you need.