def _map(d):
    if isinstance(d, (list, tuple)):
        xs = d
        if (len(xs) > max_length_of_list):
            xs = d[:max_length_of_list]
        if with_tail:
            xs.extend(d[(- max_length_of_list):])
        return modifier.modify_list(_map, xs)
    elif hasattr(d, 'keys'):
        return modifier.modify_dict(_map, d)
    elif isinstance(d, str):
        s = d
        if (len(s) > max_length_of_string):
            s = (s[:max_length_of_string] + cont_suffix)
        return s
    else:
        return d
def _map(d):
    if isinstance(d, (list, tuple)):
        xs = d
        if (len(xs) > max_length_of_list):
            xs = d[:max_length_of_list]
        if with_tail:
            xs.extend(d[(- max_length_of_list):])
        return modifier.modify_list(_map, xs)
    elif hasattr(d, 'keys'):
        return modifier.modify_dict(_map, d)
    elif isinstance(d, str):
        s = d
        if (len(s) > max_length_of_string):
            s = (s[:max_length_of_string] + cont_suffix)
        return s
    else:
        return d