code: def open(self, session, resource_name,
               access_mode=constants.AccessModes.no_lock, open_timeout=constants.VI_TMO_IMMEDIATE):
          
  
          try:
              open_timeout = int(open_timeout)
          except ValueError:
              raise ValueError('open_timeout (%r) must be an integer (or compatible type)' % open_timeout)
  
          try:
              parsed = rname.parse_resource_name(resource_name)
          except rname.InvalidResourceName:
              return 0, constants.StatusCode.error_invalid_resource_name
  
          # Loops through all session types, tries to parse the resource name and if ok, open it.
          cls = sessions.Session.get_session_class(parsed.interface_type_const, parsed.resource_class)
  
          sess = cls(session, resource_name, parsed)
  
          try:
              sess.device = self.devices[sess.attrs[constants.VI_ATTR_RSRC_NAME]]
          except KeyError:
              return 0, constants.StatusCode.error_resource_not_found
  
          return self._register(sess), constants.StatusCode.success
docs: Opens a session to the specified resource.
  
          Corresponds to viOpen function of the VISA library.
  
          :param session: Resource Manager session
                          (should always be a session returned
                          from open_default_resource_manager()).
          :param resource_name: Unique symbolic name of a resource.
          :param access_mode: Specifies the mode by which the resource is to be accessed. (constants.AccessModes)
          :param open_timeout: Specifies the maximum time period (in milliseconds) that this operation waits
                               before returning an error.
          :return: Unique logical identifier reference to a session, return value of the library call.
          :rtype: session, :class:`pyvisa.constants.StatusCode`