def normalize_key(key):
    """
    Return tuple of (group, key) from key.
    """

    if isinstance(key, str):
        group, _, key = key.partition(".")
    elif isinstance(key, tuple):
        group, key = key
    else:
        raise TypeError(f"invalid key type: {type(key).__class__}")
    return group, key or None