def duration_isoformat(tduration, format=D_DEFAULT):
    '''
    Format duration strings.

    This method is just a wrapper around isodate.isostrf.strftime and uses
    P%P (D_DEFAULT) as default format.
    '''
    # TODO: implement better decision for negative Durations.
    #       should be done in Duration class in consistent way with timedelta.
    if (((isinstance(tduration, Duration) and
          (tduration.years < 0 or tduration.months < 0 or
           tduration.tdelta < timedelta(0))) or
        (isinstance(tduration, timedelta) and
         (tduration < timedelta(0))))):
        ret = '-'
    else:
        ret = ''
    ret += strftime(tduration, format)
    return ret

    Format duration strings.

    This method is just a wrapper around isodate.isostrf.strftime and uses
    P%P (D_DEFAULT) as default format.
    
Solutions/CyberArkAudit/Data Connectors/.python_packages/lib/site-packages/isodate/isoduration.py