def dfs_complicated(self, seq, cur, result):
        """
        checking done by the children
        :param seq:
        :param cur:
        :param result:
        :return:
        """
        if len(cur)>4:
            return

        if not cur or self.is_valid(cur[-1]):
            if len(cur)==4 and not seq:  # check the last one first
                result.append(".".join(cur))
                return

            for i in xrange(1, min(3, len(seq))+1):
                self.dfs(seq[i:], cur+[seq[:i]], result)
dataset/ETHPy150Open algorhythms/LeetCode/093 Restore IP Addresses.py/Solution.dfs_complicated/original