from datetime import datetime


def default(obj):
    """Encode datetime to string in YYYY-MM-DDTHH:MM:SS format (RFC3339)"""
    if isinstance(obj, datetime):
        return obj.isoformat()
    return obj