def build_id(Z: int, A: int, state: str = "") -> int:
    """
    Builds a canonical nuclide id from atomic number, atomic mass, and
    and energy state.

    Parameters
    ----------
    Z : int
        Atomic number.
    A : int
        Atomic mass.
    state : str
        energy state.

    Returns
    -------
    int
        Canonical nuclide id.

    Examples
    --------
    >>> rd.utils.build_id(1,2)
    10020000
    >>> rd.utils.build_id(28,56,'m')
    280560001

    """

    if state != "":
        if state == "m":
            state_int = 1
        elif state == "n":
            state_int = 2
        else:
            raise ValueError(state + " is not a valid energy state.")
    else:
        state_int = 0

    canonical_id = (Z * 10000000) + (A * 10000) + state_int

    return canonical_id