<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def explode(prefix: str):
 """ given an array of objects de-normalized into fields """

    def _app(i, e=None):
        if i is not None:
            return {k: v for (k, v) in iter_fields(i)}, None
        return i, e

    def iter_fields(event_field: Union[dict, list]):
        if type(event_field) is dict:
            for key, val in event_field.items():
                yield (key, val)
        elif type(event_field) is list:
            for i, value in enumerate(event_field):
                for key, val in value.items():
                    if not i == 0:
                        yield ("{}_{}".format(key, i), val)
                    else:
                        yield (key, val)

    return compose(_app, add_column_prefix(prefix))