    def flatten(self, cont):
        """Turn nested container to flat container

        Example:
        --------
            v = Visitor(visit_types=(list,))
            v.flatten([[1,2,3], 4, [5,6,7]])
            >>> [1,2,3,4,5,6,7]
        """
        if not self.is_visitable(cont):
            # End up here only if first level of recursion
            return [cont]

        tgtcont = []
        for key, subcont in self.iter(cont):

            if self.is_visitable(subcont):
                out = self.flatten(subcont)
            else:
                out = [subcont]
            tgtcont += out
        return tgtcont
Turn nested container to flat container

Example:
--------
v = Visitor(visit_types=(list,))
v.flatten([[1,2,3], 4, [5,6,7]])
>>> [1,2,3,4,5,6,7]
rocketry/pybox/container/visitor.py