docs: def make_table(value, pattern, care=np.ones((3,3),bool)):
      '''Return a table suitable for table_lookup
      
      value - set all table entries matching "pattern" to "value", all others
              to not "value"
      pattern - a 3x3 boolean array with the pattern to match
      care    - a 3x3 boolean array where each value is true if the pattern
                must match at that position and false if we don't care if
                the pattern matches at that position.
      '''
      def fn(index, p,i,j):
          '''Return true if bit position "p" in index matches pattern'''
          return ((((index & 2**p) > 0) == pattern[i,j]) or not care[i,j])
      return np.array([value 
                       if (fn(i,0,0,0) and fn(i,1,0,1) and fn(i,2,0,2) and
                           fn(i,3,1,0) and fn(i,4,1,1) and fn(i,5,1,2) and
                           fn(i,6,2,0) and fn(i,7,2,1) and fn(i,8,2,2))
                       else not value
                       for i in range(512)], bool)