<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remap_args(input_args, remap):
 """ Generate a new argument list by remapping keys. The 'remap' dict maps from destination key -> priority list of source keys """

    out_args = input_args
    for dest_key, src_keys in remap.items():
        remap_value = None
        if isinstance(src_keys, str):
            src_keys = [src_keys]

        for key in src_keys:
            if key in input_args:
                remap_value = input_args[key]
                break

        if remap_value is not None:
            if out_args is input_args:
                out_args = {**input_args}
            out_args[dest_key] = remap_value

    return out_args