def import_function(self, node, force):
        """
        Create the ScoreFunction models and child scores.

        @param force: Should the ScoreFunction settings be written if the model already exist?
        @returns: A newly created score function object.
        """
        attributes = {
            'calculator': node.get('calculator')[:500],
            'name': node.get('id')[:50],
            'is_planscore': node.get('type') == 'plan'
        }
        fn_obj, created, changed, message = check_and_update(ScoreFunction, overwrite=force, **attributes)

        for locale in [l[0] for l in settings.LANGUAGES]:
            po = self.poutils[locale]
            po.add_or_update(
                msgid=attributes['name'] % u'%s short label',
                msgstr=node.get('label') or '',
                occurs=[(os.path.abspath(self.store.datafile), node.sourceline,)]
            )
            po.add_or_update(
                msgid=u'%s label' % attributes['name'],
                msgstr=node.get('label') or '',
                occurs=[(os.path.abspath(self.store.datafile), node.sourceline,)]
            )
            po.add_or_update(
                msgid=u'%s long description' % attributes['name'],
                msgstr=node.get('description') or '',
                occurs=[(os.path.abspath(self.store.datafile), node.sourceline,)]
            )

        lbodies = []
        for lb in self.store.filter_function_legislative_bodies(node):
            lbodies.append(lb.get('ref'))
        lbodies = list(LegislativeBody.objects.filter(name__in=lbodies))
        fn_obj.selectable_bodies.add(*lbodies)

        if changed and not force:
            logger.info(message)
        else:
            logger.debug(message)

        # Recursion if any ScoreArguments!
        self.import_arguments(fn_obj, node, force)

        return fn_obj
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/config.py/ConfigImporter.import_function/swapped operands of `%`