code: def make_stone_friendly(self, data_type, val, validate):
          
          if isinstance(data_type, bv.Timestamp):
              try:
                  ret = datetime.datetime.strptime(val, data_type.format)
              except (TypeError, ValueError) as e:
                  raise bv.ValidationError(e.args[0])
          elif isinstance(data_type, bv.Bytes):
              if self.for_msgpack:
                  if isinstance(val, six.text_type):
                      ret = val.encode('utf-8')
                  else:
                      ret = val
              else:
                  try:
                      ret = base64.b64decode(val)
                  except TypeError:
                      raise bv.ValidationError('invalid base64-encoded bytes')
          elif isinstance(data_type, bv.Void):
              if self.strict and val is not None:
                  raise bv.ValidationError("expected null, got value")
              return None
          else:
              if validate:
                  if self.caller_permissions.permissions:
                      data_type.validate_with_permissions(val, self.caller_permissions)
                  else:
                      data_type.validate(val)
              ret = val
          if self.alias_validators is not None and data_type in self.alias_validators:
              self.alias_validators[data_type](ret)
          return ret
docs: Convert a Python object to a type that will pass validation by its
          validator.
          Validation by ``alias_validators`` is performed even if ``validate`` is
          false.