There is a tiny typo in the livirt documentation at:
http://libvirt.org/docs/libvirt-appdev-guide-python/en-US/html/libvirt_ap...
In 'Example 4.2. Fetching a domain object from a name'
domainName = 'someguest'
dom = conn.lookupByName(domainname)
domainname or domainName