<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def format_output(old_maps, new_maps):
 """ This function takes the returned dict from `transform` and converts it to the same datatype as the input. Parameters old_maps : {FieldArray, dict} The mapping object to add new maps to. new_maps : dict A dict with key as parameter name and value is numpy.array. Returns ------- {FieldArray, dict} The old_maps object with new keys from new_maps. """


        # if input is FieldArray then return FieldArray
        if isinstance(old_maps, record.FieldArray):
            keys = new_maps.keys()
            values = [new_maps[key] for key in keys]
            for key, vals in zip(keys, values):
                try:
                    old_maps = old_maps.add_fields([vals], [key])
                except ValueError:
                    old_maps[key] = vals
            return old_maps

        # if input is dict then return dict
        elif isinstance(old_maps, dict):
            out = old_maps.copy()
            out.update(new_maps)
            return out

        # else error
        else:
            raise TypeError("Input type must be FieldArray or dict.")