def get_prep_value(self, value):

        # If the value is None, return None.
        if not value:
            if self.null or self._auto_add or (self.default != NOT_PROVIDED):
                return None
            raise ValueError('Explicit UUID required unless either `null` is '
                             'True or `auto_add` is given.')

        # If we already have a UUID, pass it through.
        if isinstance(value, uuid.UUID):
            return value

        # Convert our value to a UUID.
        return uuid.UUID(value)
Return a wrapped, valid UUID value.
dataset/ETHPy150Open lukesneeringer/django-pgfields/django_pg/models/fields/uuid.py/UUIDField.get_prep_value