def _formatArray(a, format_function, rank, max_line_len,<EOL>next_line_prefix, separator, edge_items, summary_insert):
if rank == <NUM_LIT:0>:<EOL><INDENT>obj = a.item()<EOL>if isinstance(obj, tuple):<EOL><INDENT>obj = _convert_arrays(obj)<EOL><DEDENT>return str(obj)<EOL><DEDENT>if summary_insert and <NUM_LIT:2>*edge_items < len(a):<EOL><INDENT>leading_items, trailing_items, summary_insert1 =edge_items, edge_items, summary_insert<EOL><DEDENT>else:<EOL><INDENT>leading_items, trailing_items, summary_insert1 = <NUM_LIT:0>, len(a), "<STR_LIT>"<EOL><DEDENT>if rank == <NUM_LIT:1>:<EOL><INDENT>s = "<STR_LIT>"<EOL>line = next_line_prefix<EOL>for i in range(leading_items):<EOL><INDENT>word = format_function(a[i]) + separator<EOL>s, line = _extendLine(s, line, word, max_line_len, next_line_prefix)<EOL><DEDENT>if summary_insert1:<EOL><INDENT>s, line = _extendLine(s, line, summary_insert1, max_line_len, next_line_prefix)<EOL><DEDENT>for i in range(trailing_items, <NUM_LIT:1>, -<NUM_LIT:1>):<EOL><INDENT>word = format_function(a[-i]) + separator<EOL>s, line = _extendLine(s, line, word, max_line_len, next_line_prefix)<EOL><DEDENT>word = format_function(a[-<NUM_LIT:1>])<EOL>s, line = _extendLine(s, line, word, max_line_len, next_line_prefix)<EOL>s += line + "<STR_LIT>"<EOL>s = '<STR_LIT:[>' + s[len(next_line_prefix):]<EOL><DEDENT>else:<EOL><INDENT>s = '<STR_LIT:[>'<EOL>sep = separator.rstrip()<EOL>for i in range(leading_items):<EOL><INDENT>if i > <NUM_LIT:0>:<EOL><INDENT>s += next_line_prefix<EOL><DEDENT>s += _formatArray(a[i], format_function, rank-<NUM_LIT:1>, max_line_len,<EOL>"<STR_LIT:U+0020>" + next_line_prefix, separator, edge_items,<EOL>summary_insert)<EOL>s = s.rstrip() + sep.rstrip() + '<STR_LIT:\n>'*max(rank-<NUM_LIT:1>, <NUM_LIT:1>)<EOL><DEDENT>if summary_insert1:<EOL><INDENT>s += next_line_prefix + summary_insert1 + "<STR_LIT:\n>"<EOL><DEDENT>for i in range(trailing_items, <NUM_LIT:1>, -<NUM_LIT:1>):<EOL><INDENT>if leading_items or i != trailing_items:<EOL><INDENT>s += next_line_prefix<EOL><DEDENT>s += _formatArray(a[-i], format_function, rank-<NUM_LIT:1>, max_line_len,<EOL>"<STR_LIT:U+0020>" + next_line_prefix, separator, edge_items,<EOL>summary_insert)<EOL>s = s.rstrip() + sep.rstrip() + '<STR_LIT:\n>'*max(rank-<NUM_LIT:1>, <NUM_LIT:1>)<EOL><DEDENT>if leading_items or trailing_items > <NUM_LIT:1>:<EOL><INDENT>s += next_line_prefix<EOL><DEDENT>s += _formatArray(a[-<NUM_LIT:1>], format_function, rank-<NUM_LIT:1>, max_line_len,<EOL>"<STR_LIT:U+0020>" + next_line_prefix, separator, edge_items,<EOL>summary_insert).rstrip()+'<STR_LIT>'<EOL><DEDENT>return s<EOL>
formatArray is designed for two modes of operation:

    1. Full output

    2. Summarized output