def _is_subpath(path, ancestors):
  """Determines if path is a subdirectory of one of the ancestors"""
  for ancestor in ancestors:
    if not ancestor.endswith('/'):
      ancestor += '/'
    if path.startswith(ancestor):
      return True
  return False