Hey, thank you very much for this post!
Perhaps somebody is helped with my solution for my headless raspberry pi3:

An udev rule which matches the MAC Address of the button, could be one for different buttons.
#/etc/udev/rules.d/98-wolbutton.rules
ATTRS{phys}==”b8:27:eb:a0:40:b7″, SYMLINK+=”wolpc”, ACTION==”add”, TAG+=”systemd”, ENV{SYSTEMD_WANTS}=”wolbuttonpc.service”

This rule triggers a systemd service which starts a python script

/etc/systemd/system/wolbuttonpc.service

[Unit]
Description=WOL Button fuer PC

[Service]
Type=simple
ExecStart=/usr/local/bin/wolbutton.pc.py
Restart=no

/usr/local/bin/wolbutton.pc.py
The python script, slightly modified from Jon Burgess, sends a wol packet at first run and then every time the button goes up (holding the button emits a lot of button downs for me)

#!/usr/bin/env python

import sys
import evdev
from wakeonlan import wol
import syslog

devices = [evdev.InputDevice(fn) for fn in evdev.list_devices()]

if len(devices) == 0:
print “No devices found, try running with sudo”
sys.exit(1)

for device in devices:
if device.phys == “b8:27:eb:a0:40:b7”:
device.grab()
wol.send_magic_packet(“AC:22:0B:C5:5C:CF”)
for event in device.read_loop():
#event at 1492803542.433958, code 115, type 01, val 00
if event.code == 115 and event.type == 01 and event.value == 00:
syslog.syslog(‘WOL gesendet’)
wol.send_magic_packet(“AC:22:0B:C5:5C:CF”)