@staticmethod<EOL><INDENT>def format_dict_list(list_of_dicts, output_name, key=None):<DEDENT>
output_payload = {}<EOL>if list_of_dicts:<EOL><INDENT>for index, dictionary in enumerate(list_of_dicts):<EOL><INDENT>index_or_key = dictionary[key] if key else str(index)<EOL>base_name = output_name + '<STR_LIT:[>' + index_or_key + '<STR_LIT:]>'<EOL>for (param, value) in dictionary.items():<EOL><INDENT>if param != key: <EOL><INDENT>output_payload[base_name + '<STR_LIT:[>' + param + '<STR_LIT:]>'] = value<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return output_payload<EOL>
Utility method for formatting lists of dictionaries for api consumption.
Takes something like [{name: val1, email: val2},{name: val1, email: val2}] for signers
and outputs:
signers[0][name]  : val1
signers[0][email] : val2
... 

Args:
    list_of_dicts (list of dicts) - the list to format

    output_name (str) - the parameter name to prepend to each key

    key (str, optional) - Used for substituting a key present in the dictionaries for the index. The above might become signers['Lawyer']['name'] instead of using a numerical index if the key "role_name" was specified.