code: def _validated(self, value):
          
          if value is None:
              return None
          if isinstance(value, uuid.UUID):
              return value
          try:
              if isinstance(value, bytes) and len(value) == 16:
                  return uuid.UUID(bytes=value)
              else:
                  return uuid.UUID(value)
          except (ValueError, AttributeError, TypeError):
              self.fail('invalid_uuid')
docs: Format the value or raise a :exc:`ValidationError` if an error occurs.