modified MACQuery.py