# Path: src/formpack/utils/array_to_xpath.py
# def array_to_xpath(outer_arr, fns={}):
#     flattened = array_to_xpath.array_to_flattened_array(outer_arr, fns)
#     return array_to_xpath.flattened_array_to_padded_string(flattened)
# 
# Path: src/formpack/utils/replace_aliases.py
# SELECT_TYPES = list(selects.keys())
# 
# Path: src/formpack/constants.py
# UNTRANSLATED = None
# 
# OR_OTHER_COLUMN = '_or_other'
# 
# TAG_COLUMNS_AND_SEPARATORS = {
#     # Separators are used when flattening tags into a single column. Keys are
#     # column names, values are separators.
#     'hxl': '',
# }


import re
from collections import defaultdict, OrderedDict
from copy import deepcopy
from functools import reduce
from .array_to_xpath import array_to_xpath
from .replace_aliases import SELECT_TYPES
from ..constants import (
    UNTRANSLATED,
    OR_OTHER_COLUMN,
    TAG_COLUMNS_AND_SEPARATORS,
)
                col_order.append(col_)
                _placed_cols.update([col_])

    o_row = deepcopy(row)
    translations_range = list(range(0, len(translations)))
    for key in (k for k in translated_cols if k in row):
        items = row[key]
        if not isinstance(items, list):
            raise ValueError(
                '"{}" column is not translated'.format(
                    key,
                ),
                o_row,
            )
        if len(items) != len(translations):
            raise ValueError(
                'Incorrect translation count: "{}"'.format(
                    key,
                ),
                o_row,
            )
        del row[key]
        for i in translations_range:
            _t = translations[i]
            try:
                value = items[i]
            except IndexError:
                raise ValueError(
                    'Column "{}" does not have enough translations'.format(key)
                )

# Path: src/formpack/utils/array_to_xpath.py
# def array_to_xpath(outer_arr, fns={}):
#     flattened = array_to_xpath.array_to_flattened_array(outer_arr, fns)
#     return array_to_xpath.flattened_array_to_padded_string(flattened)
# 
# Path: src/formpack/utils/replace_aliases.py
# SELECT_TYPES = list(selects.keys())
# 
# Path: src/formpack/constants.py
# UNTRANSLATED = None
# 
# OR_OTHER_COLUMN = '_or_other'
# 
# TAG_COLUMNS_AND_SEPARATORS = {
#     # Separators are used when flattening tags into a single column. Keys are
#     # column names, values are separators.
#     'hxl': '',
# }


# Path: src/formpack/utils/flatten_content.py
import re
from collections import defaultdict, OrderedDict
from copy import deepcopy
from functools import reduce
from .array_to_xpath import array_to_xpath
from .replace_aliases import SELECT_TYPES
from ..constants import (
    UNTRANSLATED,
    OR_OTHER_COLUMN,
    TAG_COLUMNS_AND_SEPARATORS,
)

                col_order.append(col_)
                _placed_cols.update([col_])

    o_row = deepcopy(row)
    translations_range = list(range(0, len(translations)))
    for key in (k for k in translated_cols if k in row):
        items = row[key]
        if not isinstance(items, list):
            raise ValueError(
                '"{}" column is not translated'.format(
                    key,
                ),
                o_row,
            )
        if len(items) != len(translations):
            raise ValueError(
                'Incorrect translation count: "{}"'.format(
                    key,
                ),
                o_row,
            )
        del row[key]
        for i in translations_range:
            _t = translations[i]
            try:
                value = items[i]
            except IndexError:
                raise ValueError(
                    'Column "{}" does not have enough translations'.format(key)
                )

            if _t is UNTRANSLATED: