docs: def finto(x, ii, n, null=0):
      '''
      finto(x,ii,n) yields a vector u of length n such that u[ii] = x.
  
      Notes:
        * The ii index may be a tuple (as can be passed to numpy arrays' getitem method) in order to
          specify that the specific elements of a multidimensional output be set. In this case, the
          argument n should be a tuple of sizes (a single integer is taken to be a square/cube/etc).
        * x may be a sparse-array, but in it will be reified by this function.
  
      The following optional arguments are allowed:
        * null (defaut: 0) specifies the value that should appear in the elements of u that are not
          set.
      '''
      x  = x.toarray() if sps.issparse(x) else np.asarray(x)
      shx = x.shape
      if isinstance(ii, tuple):
          if not pimms.is_vector(n): n = tuple([n for _ in ii])
          if len(n) != len(ii): raise ValueError('%d-dim index but %d-dim output' % (len(ii),len(n)))
          sh = n + shx[1:]
      elif pimms.is_int(ii): sh = (n,) + shx
      else:                  sh = (n,) + shx[1:]
      u = np.zeros(sh, dtype=x.dtype) if null == 0 else np.full(sh, null, dtype=x.dtype)
      u[ii] = x
      return u