def unsign(self, signed_value, ttl=None):
h_size, d_size = struct.calcsize('<STR_LIT>'), self.digest.digest_size<EOL>fmt = '<STR_LIT>' % (len(signed_value) - h_size - d_size, d_size)<EOL>try:<EOL><INDENT>version, timestamp, value, sig = struct.unpack(fmt, signed_value)<EOL><DEDENT>except struct.error:<EOL><INDENT>raise BadSignature('<STR_LIT>')<EOL><DEDENT>if version != self.version:<EOL><INDENT>raise BadSignature('<STR_LIT>')<EOL><DEDENT>if ttl is not None:<EOL><INDENT>if isinstance(ttl, datetime.timedelta):<EOL><INDENT>ttl = ttl.total_seconds()<EOL><DEDENT>age = abs(time.time() - timestamp)<EOL>if age > ttl + _MAX_CLOCK_SKEW:<EOL><INDENT>raise SignatureExpired('<STR_LIT>' % (age,<EOL>ttl))<EOL><DEDENT><DEDENT>try:<EOL><INDENT>self.signature(signed_value[:-d_size]).verify(sig)<EOL><DEDENT>except InvalidSignature:<EOL><INDENT>raise BadSignature(<EOL>'<STR_LIT>' % binascii.b2a_base64(sig))<EOL><DEDENT>return value<EOL>
Retrieve original value and check it wasn't signed more
than max_age seconds ago.

:type signed_value: bytes
:type ttl: int | datetime.timedelta