def METHOD_NAME(self, i):
    if self.n == 0:
        raise RuntimeError('%s has not been allocated or built' % self.type)
    if isinstance(i, (int, int64)):
        i2 = array([i], dtype='int32')
    elif isinstance(i, list):
        i2 = asarray(i)
    elif i is None:
        i2 = None  # slice(None)
    elif len(i.shape) == 1:
        i2 = i
    else:
        #print(i, type(i), i.shape)
        i2 = i
    #print('shape=%s' % str(i2.shape))
    return i2