def _int_to_key(keys, index):
    'Convert int ``index`` to the corresponding key in ``keys``'
    if isinstance(index, int):
        try:
            return keys[index]
        except IndexError:
            # use KeyError rather than IndexError for compatibility
            raise KeyError('Index out of range of keys: %s' % (index,))
    return index
Convert int ``index`` to the corresponding key in ``keys``