Update magnet.py