from typing import Tuple


def mult(a: str, b: str) -> Tuple[complex, str]:
    """Returns product a times b of two single qubit Paulis."""
    if a not in ("I", "X", "Y", "Z") or b not in ("I", "X", "Y", "Z"):
        raise ValueError("One or more invalid Pauli keys.")
        
    prod = {"XY": "Z",
            "YZ": "X",
            "ZX": "Y"}

    if a == "I":
        return (1., b)
    if b == "I":
        return (1., a)
    if a == b:
        return (1., "I")
    
    phase = 1j
    new = a + b
    if new in prod.keys():
        return (phase, prod[new])
    else:
        return (-phase, prod[b + a])