code: def pandas_Categorical_codes(cat):
      # In 0.15+, a categorical Series has a .cat attribute which is a
      # Categorical object, and Categorical objects are what have .categories /
      # .codes attributes.
      if hasattr(cat, "cat"):
          cat = cat.cat
      if hasattr(cat, "codes"):
          return cat.codes
      else:
          return cat.labels
  
imports: import sys
  import numpy
  import six
  from six.moves import cStringIO
  from .compat import optional_dep_ok
label_desc: Use image node_id 26 for calling a global function with example usage: pandas_Categorical_codes(cat) and returns: cat, cat