import json
import requests


def get_most_recent_drawing(lottery, date):
    """Gets the most recent winning numbers for the given lottery type

    Args:
         lottery: a string representing the lottery to check
         date:    a string representing the date in YYYY-MM-DD format

    Returns:
         A string of the winning numbers.
    """
    if lottery == 'mm':
        url = 'https://data.ny.gov/resource/h6w8-42p9.json?draw_date=%s' % date
        response = json.loads(requests.get(url).text)
        if len(response) > 0:
            return 'Winning numbers: %s, Megaball: %s' % (response[0]['winning_numbers'],response[0]['mega_ball'])
        else:
            return 'No drawing for %s' % date
    elif lottery == 'pb':
        url = 'https://data.ny.gov/resource/8vkr-v8vh.json?draw_date=%s' % date
        response = json.loads(requests.get(url).text)
        if len(response) > 0:
            return 'Winning numbers: %s, Multiplier: %s' % (response[0]['winning_numbers'],response[0]['multiplier'])
        else:
            return 'No drawing for %s' % date