def METHOD_NAME(self, state, remove_arm=True):
    """
    Filters out the joints that we don't want and their positions
    :param state: initial state
    :param remove_arm: If True we remove the arm joints, if False we remove the non-arm joints (hand joints)
    :return: the filtered state
    """
    name = []
    position = []
    for name_index, pos in zip(state.state.joint_state.name, state.state.joint_state.position):
        if (remove_arm and all(s not in name_index for s in self._arm_joints)) \
                or (not remove_arm and any(s in name_index for s in self._arm_joints)):
            name.append(name_index)
            position.append(pos)
    state.state.joint_state.name = name
    state.state.joint_state.position = position
    return state