def parse_uri(uri):
  """
  Returns tuple (bucket_name, key_name, key_basename).
  Raises ValueError if invalid S3 URI is passed.
  """
  match = S3_PATH_RE.match(uri)
  if not match:
    raise ValueError("Invalid S3 URI: %s" % uri)
  key = match.group(3) or ''
  basename = match.group(4) or ''
  return match.group(1), key, basename
dataset/ETHPy150Open cloudera/hue/desktop/libs/aws/src/aws/s3/__init__.py/parse_uri/original