def b32_normalize(key: str) ->str:
    """
    Web sites often gives the secret with spaces between 4-char words. This method normalizes
    the received key into one parseable by base64, and handles padding.

    :param key: the original key.
    :return: a normalized b32 string.
    """
    key = key.upper().replace(' ', '')
    key += '=' * (-len(key) % 8)
    return key
