def get_mac(interface): try: mac_address = get_if_hwaddr(interface) return mac_address except Exception as e: shutdown("Error retrieving MAC address from {}: {}".format(interface, e))