def connect(self):
"""Connect to hypervisor and return object."""
try:
if self.read_only:
conn = libvirt.openReadOnly(self.uri)
else:
conn = libvirt.open(self.uri)
except:
raise
return conn