input: Write a function to verify the validity of a given date string. The function should return True if the date is correctly formatted and False otherwise. A date is considered valid if it follows the 'mm-dd-yyyy' format, is not empty, and the day and month numbers are within the proper ranges.
  assert validate_date('03-11-2000') == True
  assert validate_date('15-01-2012') == False
  assert validate_date('04-0-2040') == False
  assert validate_date('06-04-2020') == True
  assert validate_date('01-01-2007') == True
  assert validate_date('03-32-2011') == False
  assert validate_date('') == False
  assert validate_date('04-31-3000') == False
  assert validate_date('06-06-2005') == True
  assert validate_date('21-31-2000') == False
  assert validate_date('04-12-2003') == True
  assert validate_date('04122003') == False
  assert validate_date('20030412') == False
  assert validate_date('2003-04') == False
  assert validate_date('2003-04-12') == False
  assert validate_date('04-2003') == False
output: def validate_date(date_str):
      if not date_str:
          return False
      parts = date_str.split('-')
      if len(parts) != 3:
          return False
      month, day, year = parts
      if len(month) != 2 or len(day) != 2 or len(year) != 4:
          return False
      if not (month.isdigit() and day.isdigit() and year.isdigit()):
          return False
      month = int(month)
      day = int(day)
      if not (1 <= month <= 12):
          return False
      days_in_month = [31, 29 if year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) else 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
      if not (1 <= day <= days_in_month[month - 1]):
          return False
      return True