def pick_and_place(self, objecttype, receptacletype):
    # Step 1: Find and pick the object
    if self.name2type(self.holding) != self.name2type(objecttype):
        # I need to find the object
        entity = self.find_object(objecttype)
        if entity is None:
            # I can't find object, maybe I need to find receptacletypes that can contain the object
            r_types = self.find_canbe_contained(objecttype)
            if r_types is None:
                # I even can't find the receptacletypes that can contain the object, so I need to explore
                self.explore()
                return # after explore, maybe I will find new entity in env, so return for the next decision-making
            else:
                # I find receptacletypes that can contain the object. For each receptacletype, I need to confirm if the object is in the receptacle that corresponding to the receptacletype
                for r_type in r_types:
                    r_entitys = self.find_receptacles(r_type)
                    if r_entitys is None: # I 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 open the receptacle, maybe I will find new entity in env, return for the next decision-making
        else:
            # I find the object, then I 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)
            return # after taking the object, return for the next decision-making

    # Step 2: Find the receptacle to place the object
    receptacle = self.find_receptacle(receptacletype)
    if receptacle is None:
        # I can't find the receptacle, maybe I need to explore
        self.explore()
        return # after explore, maybe I will find new entity in env, so return for the next decision-making
    else:
        # I find the receptacle, then I need to go to it and place the object
        self.goto(receptacle.name)
        if receptacle.openable and not receptacle.isopen:
            self.open_receptacle(receptacle.name)
        self.put(self.holding, receptacle.name)
        return # after placing the object, return for the next decision-making