def convert_timedelta_str(dur):
    """Barebones support for storing a timedelta as an ISO8601 duration."""
    micro = '.{:06d}'.format(dur.microseconds) if dur.microseconds else ''
    return 'P{:d}DT{:d}{}S'.format(dur.days, dur.seconds, micro)
