from typing import Tuple def parse_s3_path(s3_path: str) -> Tuple[str, str]: if not s3_path.startswith("s3://"): raise ValueError("Invalid S3 path. It should start with 's3://'") s3_path = s3_path[5:] # Remove the "s3://" prefix parts = s3_path.split("/", 1) # Split the remaining path into two parts if len(parts) != 2: raise ValueError( "Invalid S3 path format. It should be in the format 's3://bucket/prefix'" ) bucket_name = parts[0] prefix = parts[1] return bucket_name, prefix