def METHOD_NAME(path_parts: str, *, conn: Any) -> str:
    """Drill down the directory hierarchy to find the ID of an item.
    Google Drive does not have a very good random access API by path, so we
    must look at each directory, level by level, to find the item we want.
    """
    current_parent = "root"
    folders = path_parts.split("/")
    # First tries to enter directories
    for current_folder in folders:
        conditions = [
            "mimeType = 'application/vnd.google-apps.folder'",
            f"name='{current_folder}'",
        ]
        if current_parent != "root":
            conditions.append(f"'{current_parent}' in parents")
        result = (
            conn.files().list(q=" and ".join(conditions), spaces="drive", fields="files(id, name)").execute()
        )
        files = result.get("files", [])
        if not files:
            # If the directory does not exist, break loops
            break
        current_parent = files[0].get("id")
    return current_parent