def _write_datetime(value):
    """Helper that validates a date time object."""
    if value.utcoffset() is None:
        raise ValueError('Expected datetime with time zone')
    return value.isoformat()
