def METHOD_NAME(self, obj: Any) -> Any:
    """
    Prepare and serialize payload to be sent.
    :raises ClientValueError: If the config input type doesn't match
        the given input.
    """
    if isinstance(obj, Dict):
        obj = self.dict_converter.convert(obj, self.config.input)
    if not isinstance(obj, self.config.input):
        raise ClientValueError(
            f"Invalid input service type, "
            f"expected `{self.config.input.__name__}` "
            f"got `{type(obj).__name__}`"
        )
    result = self.serializer.render(obj)
    if self.config.encoding:
        return result.encode(self.config.encoding)
    return result