def pauli_from_char(ch, n=0):
    """Make Pauli matrix from an character.

    Args:
        ch (str): "X" or "Y" or "Z" or "I".
        n (int, optional): Make Pauli matrix as n-th qubits.

    Returns:
        If ch is "X" => X, "Y" => Y, "Z" => Z, "I" => I

    Raises:
        ValueError: When ch is not "X", "Y", "Z" nor "I".
    """
    ch = ch.upper()
    if ch == "I":
        return I
    if ch == "X":
        return X(n)
    if ch == "Y":
        return Y(n)
    if ch == "Z":
        return Z(n)
    raise ValueError("ch shall be X, Y, Z or I")