@staticmethod<EOL><INDENT>def parse_duration(duration, timestamp=None):<DEDENT>
assert isinstance(duration, basestring)<EOL>assert timestamp is None or isinstance(timestamp, int)<EOL>timedelta = duration_parser(duration)<EOL>if timestamp is None:<EOL><INDENT>data = datetime.utcnow() + timedelta<EOL><DEDENT>else:<EOL><INDENT>data = datetime.utcfromtimestamp(timestamp) + timedelta<EOL><DEDENT>return calendar.timegm(data.utctimetuple())<EOL>
Interprets a ISO8601 duration value relative to a given timestamp.

:param duration: The duration, as a string.
:type: string

:param timestamp: The unix timestamp we should apply the duration to.
                  Optional, default to the current time.
:type: string

:return: The new timestamp, after the duration is applied.
:rtype: int