import time


def datetime_to_timestamp(datetime):
    """
    Takes a datetime and returns
    a unix epoch ms.
    """
    time_without_ms = time.mktime(datetime.timetuple()) * 1000
    ms = int(datetime.microsecond / 1000)

    return time_without_ms + ms