sudo apt update
sudo apt upgrade

sudo nano powerdown.py

#!/usr/bin/env python

import RPi.GPIO as GPIO
import subprocess

GPIO.setmode(GPIO.BCM)
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.wait_for_edge(3, GPIO.FALLING)

subprocess.call(['shutdown', '-h', 'now'], shell=False)

************************************
sudo mv powerdown.py /usr/local/bin/
sudo chmod +x /usr/local/bin/powerdown.py

sudo nano powerdown.sh

#! /bin/sh

case "$1" in
  start)
    echo "Starting powerdown.py"
    /usr/local/bin/powerdown.py &
    ;;
  stop)
    echo "Stopping powerdown.py"
    pkill -f /usr/local/bin/powerdown.py
    ;;
  *)
    echo "Usage: /etc/init.d/powerdown.sh {start|stop}"
    exit 1
    ;;
esac

exit 0

*********************************

sudo mv powerdown.sh /etc/init.d/
sudo chmod +x /etc/init.d/powerdown.sh

*********************************

sudo update-rc.d powerdown.sh defaults
sudo /etc/init.d/powerdown.sh start

sudo nano /boot/config.txt    "At Bottom Of File Add The Following"

dtoverlay=gpio-shutdown

Save and exit.

Then Do A Reboot:

sudo reboot