code: def clean_path(root, path, subdir=False):
      '''
      Accepts the root the path needs to be under and verifies that the path is
      under said root. Pass in subdir=True if the path can result in a
      subdirectory of the root instead of having to reside directly in the root
      '''
      if not os.path.isabs(root):
          return ''
      if not os.path.isabs(path):
          path = os.path.join(root, path)
      path = os.path.normpath(path)
      if subdir:
          if path.startswith(root):
              return path
      else:
          if os.path.dirname(path) == os.path.normpath(root):
              return path
      return 'f clean_path(root, path, subdir=False):
      '''
      Accepts the root the path needs to be under and verifies that the path is
      under said root. Pass in subdir=True if the path can result in a
      subdirectory of the root instead of having to reside directly in the root
      '''
      if not os.path.isabs(root):
          return ''
      if not os.path.isabs(path):
          path = os.path.join(root, path)
      path = os.path.normpath(path)
      if subdir:
          if path.startswith(root):
              return path
      else:
          if os.path.dirname(path) == os.path.normpath(root):
              return path
      return ''
docs: Accepts the root the path needs to be under and verifies that the path is
      under said root. Pass in subdir=True if the path can result in a
      subdirectory of the root instead of having to reside directly in the root