def normalize_portable_primitives(self, val, parent=None):
        if isinstance(val, dict):
            try:
                obj = self.to_python(val, parent)
            except __HOLE__:
                return val #TODO should this be null instead?
            else:
                return obj.pk
        return val
dataset/ETHPy150Open zbyte64/django-dockit/dockit/schema/fields.py/ReferenceField.normalize_portable_primitives