<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def open(self):
 """ Open a connection to an IOS-XR device. Connects to the device using SSH and drops into XML mode. """

        try:
            self.device = ConnectHandler(device_type='cisco_xr',
                                         ip=self.hostname,
                                         port=self.port,
                                         username=self.username,
                                         password=self.password,
                                         **self.netmiko_kwargs)
            self.device.timeout = self.timeout
            self._xml_agent_alive = True  # successfully open thus alive
        except NetMikoTimeoutException as t_err:
            raise ConnectError(t_err.args[0])
        except NetMikoAuthenticationException as au_err:
            raise ConnectError(au_err.args[0])

        self._cli_prompt = self.device.find_prompt()  # get the prompt
        self._enter_xml_mode()