docs: def discover(cls, path, depth="0"):
          """Discover a list of collections under the given ``path``.
  
          If ``depth`` is "0", only the actual object under ``path`` is
          returned.
  
          If ``depth`` is anything but "0", it is considered as "1" and direct
          children are included in the result.
  
          The ``path`` is relative.
  
          The root collection "/" must always exist.
  
          """
  
          # Path should already be sanitized
          attributes = _get_attributes_from_path(path)
  
          try:
              if len(attributes) == 3:
                  # If an item, create a collection for the item.
                  item = attributes.pop()
                  path = "/".join(attributes)
                  collection = cls(path, _is_principal(path))
                  yield collection.get(item)
                  return
  
              collection = cls(path, _is_principal(path))
          except api.exceptions.DoesNotExist:
              return
  
          yield collection
  
          if depth == "0":
              return
  
          if len(attributes) == 0:
              yield cls(posixpath.join(path, cls.user), principal=True)
          elif len(attributes) == 1:
              for journal in cls.etesync.list():
                  if journal.collection.TYPE in (api.AddressBook.TYPE, api.Calendar.TYPE, api.TaskList.TYPE):
                      yield cls(posixpath.join(path, journal.uid), principal=False)
          elif len(attributes) == 2:
              for item in collection.list():
                  yield collection.get(item)
  
          elif len(attributes) > 2:
              raise RuntimeError("Found more than one attribute. Shouldn't happen")