import re


def parse_blob_path(path):
    """Parse a gcs path into bucket name and blob name
    Args:
        path (str): the path to parse.
    Returns:
        (bucket name in the path, blob name in the path)
    Raises:
        ValueError if the path is not a valid gcs blob path.
    Example:
        `bucket_name, blob_name = parse_blob_path('gs://foo/bar')`
        `bucket_name` is `foo` and `blob_name` is `bar`
    """
    match = re.match('gs://([^/]+)/(.+)$', path)
    if match:
        return match.group(1), match.group(2)
    raise ValueError('Path {} is invalid blob path.'.format(
        path))