def look_at_obj(self, objecttype):
    # Check if the agent is already holding an object of the required type
    if self.name2type(self.holding) == self.name2type(objecttype):
        # Go to a desklamp and turn it on to examine the object
        desklamp = self.find_receptacle('desklamp')
        if desklamp is None:
            # Explore the environment to find a desklamp
            self.explore()
            return
        else:
            self.goto(desklamp.name)
            self.turn_on(desklamp.name)
            return
    else:
        # Find the object
        entity = self.find_object(objecttype)
        if entity is None:
            # Explore the environment to find the object
            self.explore()
            return
        else:
            # Go to the object's receptacle
            self.goto(entity.in_on)
            r_entity = self.seen_entitys[entity.in_on]
            if r_entity.openable and not r_entity.isopen:
                self.open_receptacle(r_entity.name)
            # Take the object
            self.take(entity.name, entity.in_on)
            
            # Find a desklamp and go to it
            desklamp = self.find_receptacle('desklamp')
            if desklamp is None:
                # Explore the environment to find a desklamp
                self.explore()
                return
            else:
                self.goto(desklamp.name)
                # Turn on the desklamp to examine the object
                self.turn_on(desklamp.name)
                return