Disable turning off a switch based on a binary sensors state

Recently got a 3D printer and quickly setup OctoPrint (fantastic BTW). Then added the Octoprint Integration to HA. I can now see the stats on my 3d printer, Awesome.
So I added a Sonoff to the power cable of the printer so when my prints are done and I am not home I can completely power off the printer.
But what I don’t want happen is to accidentally hit that switch on the front end while the 3d printer is working
the binary sensor is called binary_sensor.3d_printer_printing and the switch is call switch.3d_printer_sonoff

I followed another post about turning on and off a switch only if is a window is open. and tweaked it to fit my needs But i clearly did not do it right. Here is what I have for the code.

#3D Printer Conditional Switch
  - platform: template
    switches:
      3d_printer:
        friendly_name: '3D Printer'
        value_template: "{{ is_state('sensor.3d_printer_printing', 'off') }}"
        turn_on:
          service: switch.turn_on
          entity_id: switch.3d_printer_sonoff
        turn_off:
          service: switch.turn_off
          data_template:
            entity_id: >
              {% if is_state('binary_sensor.3d_printer_printing', 'off') %}
               entity_id: switch.3d_printer_sonoff
              {% else %}
               entity_id: switch.null
              {% endif %}
          entity_id: switch.3d_printer_sonoff

This:

        turn_off:
          service: switch.turn_off
          data_template:
            entity_id: >
              {% if is_state('binary_sensor.3d_printer_printing', 'off') %}
               entity_id: switch.3d_printer_sonoff
              {% else %}
               entity_id: switch.null
              {% endif %}
          entity_id: switch.3d_printer_sonoff

should be:

        turn_off:
          service: switch.turn_off
          data_template:
            entity_id: >
              {% if is_state('binary_sensor.3d_printer_printing', 'off') %}
               switch.3d_printer_sonoff
              {% else %}
               none
              {% endif %}

It doesn’t look like it even like the turn on section… when I reboot HA to reload the Configuration.yaml the switch starts in default position of “off” when turn it on it goes on for two seconds then turns itself off.

I Think i figured it out. On my initial post I had sensor.3d_printer_printing But that is a binary sensor. so i changed it over to binary_sensor.3d_printer_printing and it appears to be working. I almost sacrificed my 18 hour print job to test it and it indeed will not let me turn that off. I will try it again when the print is complete and the binary_sensor is off