def get_feature_summary(self, plan_version, account, subscription):
        def _get_feature_info(feature_rate):
            usage = FeatureUsageCalculator(feature_rate, self.domain).get_usage()
            feature_type = feature_rate.feature.feature_type
            return {
                'name': get_feature_name(feature_type, self.product),
                'usage': usage,
                'remaining': (
                    feature_rate.monthly_limit - usage
                    if feature_rate.monthly_limit != UNLIMITED_FEATURE_USAGE
                    else _('Unlimited')
                ),
                'type': feature_type,
                'recurring_interval': get_feature_recurring_interval(feature_type),
                'subscription_credit': self._fmt_credit(self._credit_grand_total(
                    CreditLine.get_credits_by_subscription_and_features(
                        subscription, feature_type=feature_type
                    ) if subscription else None
                )),
                'account_credit': self._fmt_credit(self._credit_grand_total(
                    CreditLine.get_credits_for_account(
                        account, feature_type=feature_type
                    ) if account else None
                )),
            }

        return map(_get_feature_info, plan_version.feature_rates.all())
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/domain/views.py/DomainSubscriptionView.get_feature_summary/original