<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _handle_update_msg(self, update_msg):
 """Extracts and processes new paths or withdrawals in given `update_msg`. Parameter: - `update_msg`: update message to process. - `valid_rts`: current valid/interesting rts to the application according to configuration of all VRFs. Assumes Multiprotocol Extensions capability is supported and enabled. """

        assert self.state.bgp_state == const.BGP_FSM_ESTABLISHED

        # Increment count of update received.
        self.state.incr(PeerCounterNames.RECV_UPDATES)

        if not self._validate_update_msg(update_msg):
            # If update message was not valid for some reason, we ignore its
            # routes.
            LOG.error('UPDATE message was invalid, hence ignoring its routes.')
            return

        # Extract advertised path attributes and reconstruct AS_PATH attribute
        self._extract_and_reconstruct_as_path(update_msg)

        # Check if path attributes have loops.
        if self._is_looped_path_attrs(update_msg):
            return

        umsg_pattrs = update_msg.pathattr_map
        mp_reach_attr = umsg_pattrs.get(BGP_ATTR_TYPE_MP_REACH_NLRI, None)
        if mp_reach_attr:
            # Extract advertised MP-BGP paths from given message.
            self._extract_and_handle_mpbgp_new_paths(update_msg)

        mp_unreach_attr = umsg_pattrs.get(BGP_ATTR_TYPE_MP_UNREACH_NLRI, None)
        if mp_unreach_attr:
            # Extract MP-BGP withdraws from given message.
            self._extract_and_handle_mpbgp_withdraws(mp_unreach_attr)

        nlri_list = update_msg.nlri
        if nlri_list:
            # Extract advertised BGP paths from given message.
            self._extract_and_handle_bgp4_new_paths(update_msg)

        withdraw_list = update_msg.withdrawn_routes
        if withdraw_list:
            # Extract BGP withdraws from given message.
            self._extract_and_handle_bgp4_withdraws(withdraw_list)