def METHOD_NAME(output: ResponseOutput, ty: Optional[Type] = None) -> Any:
    """
    This utility function decodes the response from bytes string to python object dict.
    It is related to decoding StringCodec
    """
    if output.shape not in ([1], [1, 1]):
        raise InvalidExplanationShape(output.shape)
    if ty == str:
        return bytearray(output.data[0]).decode("UTF-8")
    else:
        py_str = bytearray(output.data[0]).decode("UTF-8")
        from ast import literal_eval
        return literal_eval(py_str)