Parse a given secured key and return its associated integer, the key
    itself, and the embedded nonce.

    @param secured_key a string representation of a secured key composed
           of a key in Base62, a separator character, and a nonce.

    @param key_nonce_separator: the character that is used to separate the
           key and the nonce to form the secured key.

    @param nonce_length: the number of characters to compose the nonce.

    @param base: a sequence of characters that is used to encode the
           integer value.

    @return: a tuple ``(value, key, nonce)``:
             * ``value``: the integer value of the key.
             * ``key``: the plain-text key.
             * ``nonce``: "number used once", a pseudo-random number to
               ensure that the key cannot be reused in replay attacks.

    @raise ValueError: if the format of the secured key is invalid, or if
           the embedded nonce is of the wrong length.

def parse_secured_key(secured_key,
        key_nonce_separator='.',
        nonce_length=4,
        base=BASE62):
    """
    Parse a given secured key and return its associated integer, the key
    itself, and the embedded nonce.

    @param secured_key a string representation of a secured key composed
           of a key in Base62, a separator character, and a nonce.

    @param key_nonce_separator: the character that is used to separate the
           key and the nonce to form the secured key.

    @param nonce_length: the number of characters to compose the nonce.

    @param base: a sequence of characters that is used to encode the
           integer value.

    @return: a tuple ``(value, key, nonce)``:
             * ``value``: the integer value of the key.
             * ``key``: the plain-text key.
             * ``nonce``: "number used once", a pseudo-random number to
               ensure that the key cannot be reused in replay attacks.

    @raise ValueError: if the format of the secured key is invalid, or if
           the embedded nonce is of the wrong length.
       """
    parts = secured_key.split(key_nonce_separator)
    if len(parts) != 2:
        raise ValueError('Invalid secured key format')

    (key, nonce) = parts
    if len(nonce) != nonce_length:
        raise ValueError('Invalid length of the key nonce')

    return key_to_int(key, base=base), key, nonce