"""
Datetime utilities for consistent handling based on Django settings
"""
from datetime import datetime
from django.conf import settings
from django.utils import timezone


def get_current_datetime():
    """
    Get current datetime based on Django timezone settings
    Returns timezone-aware datetime if USE_TZ=True, naive datetime if USE_TZ=False
    """
    if settings.USE_TZ:
        return timezone.now()
    else:
        return datetime.now()


def make_datetime_compatible(dt):
    """
    Make datetime compatible with current Django timezone settings
    """
    if settings.USE_TZ:
        if dt.tzinfo is None:
            # Make naive datetime timezone-aware
            return timezone.make_aware(dt)
        return dt
    else:
        if dt.tzinfo is not None:
            # Make timezone-aware datetime naive
            return timezone.make_naive(dt)
        return dt
