Decode a bucket key into a BucketKey instance.

        :param key: The string form of a bucket key.

        :returns: A suitable instance of BucketKey corresponding to
                  the passed-in key.

def decode(cls, key):
        """
        Decode a bucket key into a BucketKey instance.

        :param key: The string form of a bucket key.

        :returns: A suitable instance of BucketKey corresponding to
                  the passed-in key.
        """

        # Determine bucket key version
        prefix, sep, param_str = key.partition(':')
        if sep != ':' or prefix not in cls._prefix_to_version:
            raise ValueError("%r is not a bucket key" % key)
        version = cls._prefix_to_version[prefix]

        # Take the parameters apart...
        parts = param_str.split('/')
        uuid = parts.pop(0)
        params = {}
        for part in parts:
            name, sep, value = part.partition('=')

            # Make sure it's well-formed
            if sep != '=':
                raise ValueError("Cannot interpret parameter expression %r" %
                                 part)

            params[name] = cls._decode(value)

        # Return a BucketKey
        return cls(uuid, params, version=version)