Syntax error with Conversation response

Hi,
I’m hoping for a quick fix for a test I’m doing while trying to figure out the Conversation Response action. I tried plugging in some YAML that I’ve been using for an announcement on an Echo speaker into a “Conversation Response” action, but that didn’t work so I’ve switched over to editing the automation in YAML and I’m still not able to save it due to a syntax error. The message I’m getting is “Error in parsing YAML: missed comma between flow collection entries (line: 12, column: 8)”, which confuses me because I’ve cut and paste the code from another automation without modification. I’m sure I’m missing something obvious since I don’t really understand the code to begin with, but here it is:

alias: VOICE RESPONSE TEST
description: ""
triggers:
  - trigger: conversation
    command:
      - run test
conditions: []
actions:
  - alias: Format Response
    variables:
      message: >- 
      {% set sleeptime =  state_attr('input_datetime.sleep_mode_last_ended','timestamp') - state_attr('input_datetime.sleep_mode_last_initiated','timestamp') %} 
      {%- set divisors = [('week', 7*60*60*24), ('day', 60*60*24), ('hour', 60*60), ('minute', 60 )] %}
      {%- set ns = namespace (remainder = sleeptime, result=[]) %} {%- for desc, div in divisors %}
      {%- set num = ns.remainder//div %} {%- if num %} {%- set ns.result = ns.result + [ num|float|round(0) ~ ' '~ desc ~ ('s' if num > 1 else '') ] %}
      {%- set ns.remainder = ns.remainder % div %} {%- elif num == 0 and desc == divisors[-1][0] and ns.remainder < 60 %}
      {%- set ns.result = ns.result + ['Less than 1 '~desc ] %} {%- endif %} {%- endfor %} {% if ns.result | count > 1 %}
      {{ ('You have been in bed for ') +ns.result[:-1] | join(', ') ~ ' and ' ~ ns.result[-1] +'.' }}
      {% else %} {%- set ns.result = ('You have been in bed for ') + ns.result +'. ,' %} {{ ns.result }} {% endif %}
  - set_conversation_response: "{{ message }}"
mode: single

I’d be grateful for any help getting this to work.

I think I missed a couple of spaces indent on the message.
lol
man, this stuff is unforgiving.

Should I just delete this post, or could it potentially be helpful for anyone?