def nth_char(char_map, index):
    """Returns the nth character of a character->occurrence map"""
    for char in char_map:
        if index < char_map[char]:
            return char
        index = index - char_map[char]
    return None