def datetimetostr(dt):
    """Return a RFC3339 date-time string corresponding to the given
    datetime object."""
    if dt.utcoffset() is not None:
        return dt.isoformat()
    else:
        return "%sZ" % dt.isoformat()
dataset/ETHPy150Open jmelett/pyFxTrader/trader/lib/rfc3339.py/datetimetostr/original