python – why is my function only working on the first number specified in the range?

I want this function to go through an RDD that has values that look like “2020-01-01” for various dates throughout the year. For each one that it finds, it should make it into a tuple with a 1 as the value so that it can be summed later.

def get_month2020(text):
  for month in range(1, 13):
    year_month = f'2020-{month:02}'
    if year_month in text:
      return (year_month, 1)
    else:
      return ("0000-00", 1)

However, it seems to only be working on the January entries. It correctly finds the number of entries for January, but then changes all of the other months to “0000-00”. I’ve confirmed this by changing it to:

def get_month2020(text):
  for month in range(1, 13):
    year_month = f'2020-{month:02}'
    print(year_month)

and checking using collect(). How can I get the function to go through for each month and group them according to month?