def index_of(pattern):
    """Return the index of a given pattern"""
    return pattern[0, 0] * 2 ** 0 + pattern[0, 1] * 2 ** 1 + pattern[0, 2
        ] * 2 ** 2 + pattern[1, 0] * 2 ** 3 + pattern[1, 1] * 2 ** 4 + pattern[
        1, 2] * 2 ** 5 + pattern[2, 0] * 2 ** 6 + pattern[2, 1
        ] * 2 ** 7 + pattern[2, 2] * 2 ** 8
