code: def assert_islink(path, to=None, msg=None):
      """Assert that path exists and is a symlink.
  
      If to is specified, also check that it is the target of the symlink.
      """
      path = _strpath(path)
      st = _stat_for_assert(path, False, msg)
      if not stat.S_ISLNK(st.st_mode):
          if msg is None:
              msg = "Path exists, but is not a symlink: %r" % path
          raise AssertionError(msg)
  
      if to is not None:
          to = _strpath(to)
          target = os.readlink(path)
          # TODO: Normalise the target to an absolute path?
          if target != to:
              if msg is None:
                  msg = _link_target_msg.format(
                      path=path, expected=to, actual=target
                  )
              raise AssertionError(msg)
  
file_path: catboost/contrib/python/testpath/py3/testpath/asserts.py
imports: import os
  import stat
label_desc: Use image node_id 8 for calling a global function with example usage: assert_islink(path, to, msg) without return types