def robot_pick_mug(agents, self_state, self_name, mug):
    """
    Checks if the 'mug' is reachable by the agent (robot) and if the agent does not carry anything.
    Then updates the beliefs of all the agents in the same room as the robot as for the robot having picked the 'mug'
    """
    if self_name in self_state.isReachableBy[mug] and self_state.isHolding[self_name] == []:
        robot_room = self_state.isInRoom[self_name][0]
        for agent_name in self_state.agentsInRoom[robot_room]:
            a = agents[agent_name]
            a.state.isReachableBy[mug] = []
            a.state.isHolding[self_name] = [mug]
            a.state.isHeldBy[mug] = [self_name]
        return agents
    return False