Refactor ethernet.py