human
Can you provide a the Python program you requested given the following:
Complete the below
def key_type_n(index):

    ''''Pull out the nth (0-based) key type from a key which has parents.
    This is most useful when paired with key_id_or_name_as_string_n.
    This is a useful complement to create_deep_key.
    Args:
    index: The depth of the id or name to extract. Zero is the root key.
    Negative one is the leaf key.
    Returns:
    Method returning the type (\'ID\' or \'name\') of the key at depth index.
    Returns \'\' if key is empty (unsaved), otherwise raises IndexError
    if the key is not as deep as described.'
    '''
assistant
#Here is the Python program you requested.
    def transform_function(key):
        id_or_name = _key_id_or_name_n(key, index)
        if (id_or_name is None):
            return ''
        if isinstance(id_or_name, basestring):
            return KEY_TYPE_NAME
        return KEY_TYPE_ID
    return transform_function