Yes. You can configure Postfix to query your Python daemon about aliases using the socketmap protocol.
There are a few implementations of socketmap daemons in python. E.g. pysrs.
Here are a few links that you can reference to get everything set up properly:
Postfix alias_database documentation.
Postfix database lookup table types.
Postfix socketmap_table documentation.
A code was sent to the recovery email address. Please provide the 6-digit code.
A code can be retrieved from your authentication app. Please provide the 6-digit code.
An email was sent to your recovery email address. If you need further assistance, please contact your system admin.