code: def ndims(self):
          
          if self._dims is None:
              return None
          else:
              if self._ndims is None:
                  self._ndims = len(self._dims)
              return self._ndims
docs: Returns the rank of this shape, or None if it is unspecified.