def format(dt, usec=True, offset=True):
    # pylint: disable=no-member
    if isinstance(dt, basestring):
        dt = parse(dt)
    fmt = ISO8601_FORMAT_MICROSECOND if usec else ISO8601_FORMAT
    if offset:
        ost = dt.strftime('%z')
        ost = (ost[:3] + ':' + ost[3:]) if ost else '+00:00'
    else:
        tz = dt.tzinfo.tzname(dt) if dt.tzinfo else 'UTC'
        ost = 'Z' if tz == 'UTC' else tz
    return dt.strftime(fmt) + ost
Parse the dmraid line
dataset/ETHPy150Open StackStorm/st2/st2common/st2common/util/isotime.py/format--crossover with--dataset/ETHPy150Open saltstack/salt/salt/utils/kickstart.py/parse_dmraid