import pytz


def dt_to_ms(dt):
    """Converts a datetime to a POSIX timestamp in milliseconds"""
    if dt.tzinfo is None:
        dt = dt.replace(tzinfo=pytz.UTC)
    return int(dt.timestamp() * 1000)