S3Meterer.resource_to_bucket_and_key(resource_name) -> (str, str)

        Convert an S3 resource name in the form 's3://bucket/key' to a tuple
        of ('bucket', 'key').

def resource_to_bucket_and_key(resource_name):
        """
        S3Meterer.resource_to_bucket_and_key(resource_name) -> (str, str)

        Convert an S3 resource name in the form 's3://bucket/key' to a tuple
        of ('bucket', 'key').
        """
        if not resource_name.startswith(S3Meterer.s3_url_prefix):
            raise ValueError("Expected resource_name to start with %s" %
                             S3Meterer.s3_url_prefix)

        s3_bucket_and_key = resource_name[len(S3Meterer.s3_url_prefix):]

        try:
            bucket, key = s3_bucket_and_key.split("/", 1)
            if not bucket:
                raise ValueError("Bucket name cannot be empty in URL %r" %
                                 resource_name)

            return (bucket, key)
        except ValueError:
            raise ValueError("No key specified in URL %r" % resource_name)