code: def relative_filename_within_dir(filename: str, directory: str) -> str:
      
      filename = os.path.abspath(filename)
      directory = os.path.abspath(directory)
      if os.path.commonpath([directory, filename]) != directory:
          # Filename is not within directory
          return ""
      return os.path.relpath(filename, start=directory)
docs: Starting with a (typically absolute) ``filename``, returns the part of the
      filename that is relative to the directory ``directory``.
      If the file is *not* within the directory, returns an empty string.