def register(self, state, transform, validators=[], raw=False):
        registry = self._get_registry(raw)

        try:
            state_xforms = registry[state]
        except KeyError:
            registry[state] = OrderedDict()
            state_xforms = registry[state]

        try:
            if issubclass(transform, Transform):
                # Transform is a class. Instantiate it.
                transform_obj = transform()
        except __HOLE__:
            # Transform is a function. Wrap it in a class instance.
            transform_obj = FunctionWrappingTransform(transform)

        transform_obj.add_validation(*validators)
        state_xforms[transform_obj.name] = transform_obj
dataset/ETHPy150Open openelections/openelections-core/openelex/base/transform.py/Registry.register