Too few details to say something specific, but I will try. It depends on the complexity of the situation, but you may be happy with a simple parameterization that turns on / off the functions:
class AccountRepository: def constructor(have_feature_a, have_feature_b, etc):
This works great if you have few such functions and they have very small things (represented in a few lines of code). If some of these functions are heavy, they can be encapsulated in a separate class using a well-known interface. This is called a strategy. This strategy is AccountRepository introduced by AccountRepository as a dependency. This is known as DI or dependency:
class AccountRepository: def constructor(have_feature_a, feature_b_worker, etc):
Now you can even have several FeatureB implementations and use any of them for different cases. For instance. one for tests and one for production.
source share