code: def set_attribute(self, attribute, attribute_state):
          
  
          # Check that the attribute exists.
          try:
              attr = attributes.AttributesByID[attribute]
          except KeyError:
              return constants.StatusCode.error_nonsupported_attribute
  
          # Check that the attribute is valid for this session type.
          if not attr.in_resource(self.session_type):
              return constants.StatusCode.error_nonsupported_attribute
  
          # Check that the attribute is writable.
          if not attr.write:
              return constants.StatusCode.error_attribute_read_only
  
          try:
              self.attrs[attribute] = attribute_state
          except ValueError:
              return constants.StatusCode.error_nonsupported_attribute_state
  
          return constants.StatusCode.success
docs: Get an attribute from the session.
  
          :param attribute:
          :return: attribute value, status code
          :rtype: object, constants.StatusCode