simplify api.py using multiple inheritance