code: def same_directories(path1, path2):
      
      if all(os.path.isdir(p) for p in (path1, path2)):
          try:
              return os.path.samefile(path1, path2)
          except AttributeError:
              # On Windows and Python 2 os.path.samefile() is unavailable.
              return os.path.realpath(path1) == os.path.realpath(path2)
      else:
          return False
docs: Check if two pathnames refer to the same directory.
  
      :param path1: The first pathname (a string).
      :param path2: The second pathname (a string).
      :returns: :data:`True` if both pathnames refer to the same directory,
                :data:`False` otherwise.