def pick_and_place(self, objecttype, receptacletype):
    # Check if we are already holding the object
    if self.name2type(self.holding) == self.name2type(objecttype):
        # We are already holding the object, so we just need to place it
        place_receptacle = self.find_receptacle(receptacletype)
        if place_receptacle is None:
            # We can't find the receptacle, so we need to explore
            self.explore()
            return  # After exploring, maybe we will find the receptacle, so return for the next decision-making
        else:
            # We found the receptacle, so we place the object
            self.goto(place_receptacle.name)
            if place_receptacle.openable and not place_receptacle.isopen:
                self.open_receptacle(place_receptacle.name)
            self.put(self.holding, place_receptacle.name)
            return  # After placing the object, return for the next decision-making
    else:
        # We need to find the object first
        entity = self.find_object(objecttype)
        if entity is None:
            # We can't find the object, so we need to find receptacletypes that can contain the object
            r_types = self.find_canbe_contained(objecttype)
            if r_types is None:
                # We even can't find the receptacletypes that can contain the object, so we need to explore
                self.explore()
                return  # After exploring, maybe we will find new entity in env, so return for the next decision-making
            else:
                # We find receptacletypes that can contain the object. For each receptacletype, we need to confirm if the object is in the receptacle that corresponds to the receptacletype
                for r_type in r_types:
                    r_entitys = self.find_receptacles(r_type)
                    if r_entitys is None:  # We can't find the receptacle, continue to find the next receptacletype
                        continue
                    for r_entity in r_entitys:
                        self.goto(r_entity.name)
                        if r_entity.openable and not r_entity.isopen:
                            self.open_receptacle(r_entity.name)
                            return  # After opening the receptacle, maybe we will find new entity in env, return for the next decision-making
        else:
            # We find the object, so we need to go to its receptacle and then take it
            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)
            self.take(entity.name, entity.in_on)
            # Now we have the object, we need to place it into the desired receptacle
            place_receptacle = self.find_receptacle(receptacletype)
            if place_receptacle is None:
                # We can't find the receptacle, so we need to explore
                self.explore()
                return  # After exploring, maybe we will find the receptacle, so return for the next decision-making
            else:
                # We found the receptacle, so we place the object
                self.goto(place_receptacle.name)
                if place_receptacle.openable and not place_receptacle.isopen:
                    self.open_receptacle(place_receptacle.name)
                self.put(self.holding, place_receptacle.name)
                return  # After placing the object, return for the next decision-making