def suffix(key, term):
    """ suffix a key with a suffix

    Works if they key is a string or a tuple

    >>> suffix('x', '.dtype')
    'x.dtype'
    >>> suffix(('a', 'b', 'c'), '.dtype')
    ('a', 'b', 'c.dtype')
    """
    if isinstance(key, str):
        return key + term
    elif isinstance(key, tuple):
        return key[:-1] + (suffix(key[-1], term),)
    else:
        return suffix(str(key), term)