code: def rstrip(value: str) -> str:
      end = len(value) - 1
      while end >= 0:
          if not value[end].isspace():
              break
          if end > 0 and value[end - 1] == "\\":
              break  # escaped space
          end -= 1
      else:
          return ""
      return value[: end + 1]
  
file_path: dstack/src/dstack/_internal/utils/ignore.py
imports: import fnmatch
  from itertools import zip_longest
  from pathlib import Path
  from typing import Dict, List, Optional
  from dstack._internal.utils.path import PathLike
label_desc: Use image node_id 4 for calling the GitIgnore obj's underlying member method code with example usage: obj.rstrip(value) and returns: value, str