Templating Help

lol thats way more elegant then what I came up with

 cost_monthly_left:
    friendly_name: "Month Left"
    value_template: >-
      {% if now().month in [1,3,5,7,8,10,12] %}
        {{ 31 - now().day }}
      {% elif now().month in [4,6,9,11] %}
        {{ 30 - now().day }}
      {% elif now().month == 2 and ((now().year-2000) % 4 > 0) %}
        {{ 28 - now().day }}
      {% elif now().month == 2 and ((now().year-2000) % 4 == 0) %}
        {{ 29 - now().day }}
      {% endif %}

  cost_daily_ave:
    friendly_name: "Daily Ave"
    value_template: "{{ (states.sensor.monthly_total.state|float) / ( now().day) }}"
    
  cost_prediction:
    friendly_name: "Cost Prediction"
    value_template: "{{ ((states.sensor.cost_daily_ave.state|float) * (states.sensor.cost_monthly_left.state|float) + (states.sensor.monthly_total.state|float)) }}"