code: def norm_and_check(source_tree, requested):
      
      if os.path.isabs(requested):
          raise ValueError("paths must be relative")
  
      abs_source = os.path.abspath(source_tree)
      abs_requested = os.path.normpath(os.path.join(abs_source, requested))
      # We have to use commonprefix for Python 2.7 compatibility. So we
      # normalise case to avoid problems because commonprefix is a character
      # based comparison :-(
      norm_source = os.path.normcase(abs_source)
      norm_requested = os.path.normcase(abs_requested)
      if os.path.commonprefix([norm_source, norm_requested]) != norm_source:
          raise ValueError("paths must be inside source tree")
  
      return abs_requested
docs: Normalise and check a backend path.
  
      Ensure that the requested backend path is specified as a relative path,
      and resolves to a location under the given source tree.
  
      Return an absolute version of the requested path.