def guess_header(array, name='<STR_LIT>'):
header = {}<EOL>if isinstance(array, Sequence) and len(array) == <NUM_LIT:1>:<EOL><INDENT>array = array[<NUM_LIT:0>]<EOL><DEDENT>if isinstance(array, basestring):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': (<NUM_LIT:1> if len(array) > <NUM_LIT:0> else <NUM_LIT:0>, len(array))})<EOL><DEDENT>elif isinstance(array, Sequence) and len(array) == <NUM_LIT:0>:<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>', '<STR_LIT>': (<NUM_LIT:0>, <NUM_LIT:0>)})<EOL><DEDENT>elif isinstance(array, Mapping):<EOL><INDENT>field_types = [type(j) for j in array.values()]<EOL>field_lengths = [<NUM_LIT:1> if isinstance(j, (basestring, int, float))<EOL>else len(j) for j in array.values()]<EOL>if len(field_lengths) == <NUM_LIT:1>:<EOL><INDENT>equal_lengths = True<EOL>equal_types = True<EOL><DEDENT>else:<EOL><INDENT>equal_lengths = not any(diff(field_lengths))<EOL>equal_types = all([field_types[<NUM_LIT:0>] == f for f in field_types])<EOL><DEDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': (<EOL><NUM_LIT:1>,<EOL>field_lengths[<NUM_LIT:0>] if equal_lengths and equal_types else <NUM_LIT:1>)}<EOL>)<EOL><DEDENT>elif isinstance(array, int):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>', '<STR_LIT>': (<NUM_LIT:1>, <NUM_LIT:1>)})<EOL><DEDENT>elif isinstance(array, float):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>', '<STR_LIT>': (<NUM_LIT:1>, <NUM_LIT:1>)})<EOL><DEDENT>elif isinstance(array, Sequence):<EOL><INDENT>if isarray(array, lambda i: isinstance(i, int), <NUM_LIT:1>):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': (<NUM_LIT:1>, len(array))})<EOL><DEDENT>elif isarray(array, lambda i: isinstance(i, (int, float)), <NUM_LIT:1>):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': (<NUM_LIT:1>, len(array))})<EOL><DEDENT>elif (isarray(array, lambda i: isinstance(i, Sequence), <NUM_LIT:1>) and<EOL>any(diff(len(s) for s in array))):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': (<NUM_LIT:1>, len(array))<EOL>})<EOL><DEDENT>elif isarray(array, lambda i: isinstance(i, basestring), <NUM_LIT:1>):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': (len(array), len(array[<NUM_LIT:0>]))})<EOL><DEDENT>elif isarray(array, lambda i: isinstance(i, Sequence), <NUM_LIT:1>):<EOL><INDENT>if any(diff(len(j) for j in array)):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': (len(array), len(array[<NUM_LIT:0>]))})<EOL><DEDENT>elif isarray(array, lambda i: isinstance(i, int)):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': (len(array), len(array[<NUM_LIT:0>]))})<EOL><DEDENT>elif isarray(array, lambda i: isinstance(i, (int, float))):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': (len(array), len(array[<NUM_LIT:0>]))})<EOL><DEDENT><DEDENT>elif isarray(array, lambda i: isinstance(<EOL>i, (int, float, basestring, Sequence, Mapping))):<EOL><INDENT>header.update({<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': (<NUM_LIT:1>, len(array))})<EOL><DEDENT><DEDENT>if not header:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>header['<STR_LIT:name>'] = name<EOL>return header, array<EOL>
Guess the array header information.
    Returns a header dict, with class, data type, and size information.