Translates Four-Octet AS number to AS_TRANS and separates
        AS_PATH list into AS_PATH and AS4_PATH lists if needed.

        If the neighbor does not support Four-Octet AS number,
        this method constructs AS4_PATH list from AS_PATH list and swaps
        non-mappable AS number in AS_PATH with AS_TRANS, then
        returns AS_PATH list and AS4_PATH list.
        If the neighbor supports Four-Octet AS number, returns
        the given AS_PATH list and None.

def _trans_as_path(self, as_path_list):
        """Translates Four-Octet AS number to AS_TRANS and separates
        AS_PATH list into AS_PATH and AS4_PATH lists if needed.

        If the neighbor does not support Four-Octet AS number,
        this method constructs AS4_PATH list from AS_PATH list and swaps
        non-mappable AS number in AS_PATH with AS_TRANS, then
        returns AS_PATH list and AS4_PATH list.
        If the neighbor supports Four-Octet AS number, returns
        the given AS_PATH list and None.
        """

        def _swap(n):
            if is_valid_old_asn(n):
                # mappable
                return n
            else:
                # non-mappable
                return bgp.AS_TRANS

        # If the neighbor supports Four-Octet AS number, returns
        # the given AS_PATH list and None.
        if self.is_four_octet_as_number_cap_valid():
            return as_path_list, None

        # If the neighbor does not support Four-Octet AS number,
        # constructs AS4_PATH list from AS_PATH list and swaps
        # non-mappable AS number in AS_PATH with AS_TRANS.
        else:
            new_as_path_list = []
            for as_path in as_path_list:
                if isinstance(as_path, set):
                    path_set = set()
                    for as_num in as_path:
                        path_set.add(_swap(as_num))
                    new_as_path_list.append(path_set)
                elif isinstance(as_path, list):
                    path_list = list()
                    for as_num in as_path:
                        path_list.append(_swap(as_num))
                    new_as_path_list.append(path_list)
                else:
                    # Ignore invalid as_path type
                    pass

            # If all of the AS_PATH list is composed of mappable four-octet
            # AS numbers only, returns the given AS_PATH list
            # Assumption: If the constructed AS_PATH list is the same as
            # the given AS_PATH list, all AS number is mappable.
            if as_path_list == new_as_path_list:
                return as_path_list, None

            return new_as_path_list, as_path_list