code: def categorical_order(vector, order=None):
      """Return a list of unique data values.
  
      Determine an ordered list of levels in ``values``.
  
      Parameters
      ----------
      vector : list, array, Categorical, or Series
          Vector of "categorical" values
      order : list-like, optional
          Desired order of category levels to override the order determined
          from the ``values`` object.
  
      Returns
      -------
      order : list
          Ordered list of category levels not including null values.
  
      """
      if order is None:
          if hasattr(vector, "categories"):
              order = vector.categories
          else:
              try:
                  order = vector.cat.categories
              except (TypeError, AttributeError):
                  order = pd.Series(vector).unique()
  
                  if variable_type(vector) == "numeric":
                      order = np.sort(order)
  
          order = filter(pd.notnull, order)
      return list(order)
  
imports: from __future__ import annotations
  import warnings
  import itertools
  from copy import copy
  from collections import UserString
  from collections.abc import Iterable, Sequence, Mapping
  from numbers import Number
  from datetime import datetime
  import numpy
  import pandas
  import matplotlib
  from seaborn._core.data import PlotData
  from seaborn.palettes import QUAL_PALETTES, color_palette
  from seaborn.utils import _check_argument, _version_predates, desaturate, locator_to_legend_entries, get_color_cycle, remove_na
label_desc: Use image node_id 5 for calling a global function with example usage: categorical_order(vector, order) and returns: list