code: def append_dir_sep(path: pathlib.Path) -> str:
      """
      Appends the path separator to the path if the path is a directory.
      This can be used to aid in distinguishing between directories and
      files on the file-system by relying on the presence of a trailing path
      separator.
  
      *path* (:class:`pathlib.Path`) is the path to use.
  
      Returns the path (:class:`str`).
      """
      str_path = str(path)
      if path.is_dir():
          str_path += os.sep
  
      return str_path
  
imports: import os
  import os.path
  import pathlib
  import posixpath
  import stat
  import sys
  import warnings
  from collections.abc import Collection, Iterable
  from dataclasses import dataclass
  from os import PathLike
  from typing import Any, AnyStr, Callable, Collection, Dict, Generic, Iterable, Iterator, List, Optional, Sequence, Set, Tuple, TypeVar, Union
  from .pattern import Pattern
label_desc: Use image node_id 1 for calling a global function with example usage: append_dir_sep(path) and returns: str_path