def midnight_datetime(dtime):
    """ Takes a datetime object and returns a datetime at midnight of the
        given day """
    midnightDt = dtime.replace(minute=0, hour=0, second=0, microsecond=0)
    return midnightDt
