def toString(self, i):
        offset = i.utcoffset()
        if offset is None:
            raise ValueError(
                'amp.DateTime cannot serialize naive datetime instances.  '
                'You may find amp.utc useful.')

        minutesOffset = (offset.days * 86400 + offset.seconds) // 60

        if minutesOffset > 0:
            sign = '+'
        else:
            sign = '-'

        # strftime has no way to format the microseconds, or put a ':' in the
        # timezone. Suprise!

        return '%04i-%02i-%02iT%02i:%02i:%02i.%06i%s%02i:%02i' % (
            i.year,
            i.month,
            i.day,
            i.hour,
            i.minute,
            i.second,
            i.microsecond,
            sign,
            abs(minutesOffset) // 60,
            abs(minutesOffset) % 60)
Serialize a C{datetime.datetime} instance to a string in the specified
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/protocols/amp.py/DateTime.toString