def METHOD_NAME(
    payload: Any,
    request_output: RequestOutput,
    metadata_outputs: Dict[str, MetadataTensor] = {},
) -> Optional[ResponseOutput]:
    output_metadata = metadata_outputs.get(request_output.name)
    content_type = _get_content_type(request_output, output_metadata)
    codec = (
        find_input_codec(content_type)
        if content_type
        else find_input_codec_by_payload(payload)
    )
    if not codec:
        return None
    return codec.encode_output(
        name=request_output.name,
        payload=payload,
    )