def deserialize(self, serialized):
        '''Deserialize a JSON macaroon depending on the format.

        @param serialized the macaroon in JSON format.
        @return the macaroon object.
        '''
        deserialized = json.loads(serialized)
        if deserialized.get('identifier') is None:
            return self._deserialize_v2(deserialized)
        else:
            return self._deserialize_v1(deserialized)
Deserialize a JSON macaroon depending on the format.

        @param serialized the macaroon in JSON format.
        @return the macaroon object.