code: def relative_uri(base: str, to: str) -> str:
      """Return a relative URL from ``base`` to ``to``."""
      if to.startswith(SEP):
          return to
      b2 = base.split("#")[0].split(SEP)
      t2 = to.split("#")[0].split(SEP)
      # remove common segments (except the last segment)
      for x, y in zip(b2[:-1], t2[:-1]):
          if x != y:
              break
          b2.pop(0)
          t2.pop(0)
      if b2 == t2:
          # Special case: relative_uri('f/index.html','f/index.html')
          # returns '', not 'index.html'
          return ""
      if len(b2) == 1 and t2 == [""]:
          # Special case: relative_uri('f/index.html','f/') should
          # return './', not ''
          return "." + SEP
      return (".." + SEP) * (len(b2) - 1) + SEP.join(t2)
  
imports: from __future__ import annotations
  import contextlib
  import filecmp
  import os
  import re
  import shutil
  import sys
  import unicodedata
  from io import StringIO
  from os import path
  from typing import TYPE_CHECKING, Any
  from sphinx.deprecation import _deprecation_warning
label_desc: Use image node_id 4 for calling a global function with example usage: relative_uri(base, to) and returns: unknown, to, str, unknown