import pytz


def dout(obj):
    """
    Helper function to ensure that we're always printing internal
    datetime objects in a fully qualified UTC timezone. This will
    let 'None' values pass through untouched.
    """
    if obj is None:
        return
    if obj.tzinfo:
        return obj.astimezone(pytz.UTC).isoformat()
    return pytz.UTC.localize(obj).isoformat()