def _build_comment_options_op(self, author, permlink, options, beneficiaries):
    options = remove_from_dict((options or {}), ['max_accepted_payout', 'percent_crea_dollars', 'allow_votes', 'allow_curation_rewards', 'extensions'], keep_keys=True)
    if beneficiaries:
        weight_sum = 0
        for b in beneficiaries:
            if ('account' not in b):
                raise ValueError('beneficiaries need an account field!')
            if ('weight' not in b):
                b['weight'] = CREA_100_PERCENT
            if (len(b['account']) > 16):
                raise ValueError('beneficiaries error, account name length >16!')
            if ((b['weight'] < 1) or (b['weight'] > CREA_100_PERCENT)):
                raise ValueError(('beneficiaries error, 1<=weight<=%s!' % CREA_100_PERCENT))
            weight_sum += b['weight']
        if (weight_sum > CREA_100_PERCENT):
            raise ValueError(('beneficiaries exceed total weight limit %s' % CREA_100_PERCENT))
        options['beneficiaries'] = beneficiaries
    default_max_payout = ('1000000.000 %s' % self.sbd_symbol)
    comment_op = operations.Comment_options(**{'author': author, 'permlink': permlink, 'max_accepted_payout': options.get('max_accepted_payout', default_max_payout), 'percent_crea_dollars': int(options.get('percent_crea_dollars', CREA_100_PERCENT)), 'allow_votes': options.get('allow_votes', True), 'allow_curation_rewards': options.get('allow_curation_rewards', True), 'extensions': options.get('extensions', []), 'beneficiaries': options.get('beneficiaries', []), 'prefix': self.prefix})
    return comment_op
def _build_comment_options_op(self, author, permlink, options, beneficiaries):
    options = remove_from_dict((options or {}), ['max_accepted_payout', 'percent_crea_dollars', 'allow_votes', 'allow_curation_rewards', 'extensions'], keep_keys=True)
    if beneficiaries:
        weight_sum = 0
        for b in beneficiaries:
            if ('account' not in b):
                raise ValueError('beneficiaries need an account field!')
            if ('weight' not in b):
                b['weight'] = CREA_100_PERCENT
            if (len(b['account']) > 16):
                raise ValueError('beneficiaries error, account name length >16!')
            if ((b['weight'] < 1) or (b['weight'] > CREA_100_PERCENT)):
                raise ValueError(('beneficiaries error, 1<=weight<=%s!' % CREA_100_PERCENT))
            weight_sum += b['weight']
        if (weight_sum > CREA_100_PERCENT):
            raise ValueError(('beneficiaries exceed total weight limit %s' % CREA_100_PERCENT))
        options['beneficiaries'] = beneficiaries
    default_max_payout = ('1000000.000 %s' % self.sbd_symbol)
    comment_op = operations.Comment_options(**{'author': author, 'permlink': permlink, 'max_accepted_payout': options.get('max_accepted_payout', default_max_payout), 'percent_crea_dollars': int(options.get('percent_crea_dollars', CREA_100_PERCENT)), 'allow_votes': options.get('allow_votes', True), 'allow_curation_rewards': options.get('allow_curation_rewards', True), 'extensions': options.get('extensions', []), 'beneficiaries': options.get('beneficiaries', []), 'prefix': self.prefix})
    return comment_op