Might be better to do something like ```if not isinstance(shape, collections.Sequence)``` so as to allow np.int32 etc.