@staticmethod<EOL><INDENT>def _handle_array(toks):<DEDENT>
if len(toks) == <NUM_LIT:5> and toks[<NUM_LIT:1>] == '<STR_LIT:{>' and toks[<NUM_LIT:4>] == '<STR_LIT:}>':<EOL><INDENT>subtree = toks[<NUM_LIT:2>:<NUM_LIT:4>]<EOL>signature = '<STR_LIT>'.join(s for (_, s) in subtree)<EOL>[key_func, value_func] = [f for (f, _) in subtree]<EOL>def the_dict_func(a_dict, variant=<NUM_LIT:0>):<EOL><INDENT>"""<STR_LIT>"""<EOL>elements =[(key_func(x), value_func(y)) for (x, y) in a_dict.items()]<EOL>level = <NUM_LIT:0> if elements == []else max(max(x, y) for ((_, x), (_, y)) in elements)<EOL>(obj_level, func_level) =_ToDbusXformer._variant_levels(level, variant)<EOL>return (dbus.types.Dictionary(<EOL>((x, y) for ((x, _), (y, _)) in elements),<EOL>signature=signature,<EOL>variant_level=obj_level), func_level)<EOL><DEDENT>return (the_dict_func, '<STR_LIT>' + signature + '<STR_LIT:}>')<EOL><DEDENT>if len(toks) == <NUM_LIT:2>:<EOL><INDENT>(func, sig) = toks[<NUM_LIT:1>]<EOL>def the_array_func(a_list, variant=<NUM_LIT:0>):<EOL><INDENT>"""<STR_LIT>"""<EOL>if isinstance(a_list, dict):<EOL><INDENT>raise IntoDPValueError(a_list, "<STR_LIT>",<EOL>"<STR_LIT>")<EOL><DEDENT>elements = [func(x) for x in a_list]<EOL>level = <NUM_LIT:0> if elements == [] else max(x for (_, x) in elements)<EOL>(obj_level, func_level) =_ToDbusXformer._variant_levels(level, variant)<EOL>return (dbus.types.Array(<EOL>(x for (x, _) in elements),<EOL>signature=sig,<EOL>variant_level=obj_level), func_level)<EOL><DEDENT>return (the_array_func, '<STR_LIT:a>' + sig)<EOL><DEDENT>raise IntoDPValueError(toks, "<STR_LIT>",<EOL>"<STR_LIT>")<EOL>
Generate the correct function for an array signature.

:param toks: the list of parsed tokens
:returns: function that returns an Array or Dictionary value
:rtype: ((or list dict) -> ((or Array Dictionary) * int)) * str