code: def lock(self, session, lock_type, timeout, requested_key=None):
          
          try:
              sess = self.sessions[session]
          except KeyError:
              return StatusCode.error_invalid_object
  
          return sess.lock(lock_type, timeout, requested_key)
docs: Establishes an access mode to the specified resources.
  
          Corresponds to viLock function of the VISA library.
  
          :param session: Unique logical identifier to a session.
          :param lock_type: Specifies the type of lock requested, either Constants.EXCLUSIVE_LOCK or Constants.SHARED_LOCK.
          :param timeout: Absolute time period (in milliseconds) that a resource waits to get unlocked by the
                          locking session before returning an error.
          :param requested_key: This parameter is not used and should be set to VI_NULL when lockType is VI_EXCLUSIVE_LOCK.
          :return: access_key that can then be passed to other sessions to share the lock, return value of the library call.
          :rtype: str, :class:`pyvisa.constants.StatusCode`