code: def format_optional_vector(x):
      
  
      # If vector is None or all elements are NaN, then return none
      # Otherwise format the vector as normal
      if x is None or np.all(np.isnan(x)):
          return 'none'
      else:
          return format_vector(x)
docs: Format a (N,) :class:`numpy.ndarray` into a NRRD optional vector string
  
      Function converts a (N,) :class:`numpy.ndarray` or :obj:`None` into a string using NRRD vector format. If the input
      :obj:`x` is :obj:`None`, then :obj:`vector` will be 'none'
  
      See :ref:`user-guide:int vector` and :ref:`user-guide:double vector` for more information on the format.
  
      Parameters
      ----------
      x : (N,) :class:`numpy.ndarray` or :obj:`None`
          Vector to convert to NRRD vector string
  
      Returns
      -------
      vector : :class:`str`
          String containing NRRD vector