code: def canonicalize_path(path):
      
      if isinstance(path, six.binary_type):
          return path
      if isinstance(path, six.text_type):
          return _fsencode(path)
      else:
          return canonicalize_path(str(path))
docs: Canonicalizes a potential path.
  
      Returns a binary string encoded into filesystem encoding.