'Save a small summary of the call using json format in the
output directory.
output_dir: string
directory where to write metadata.
duration: float
time taken by hashing input arguments, calling the wrapped
function and persisting its output.
args, kwargs: list and dict
input arguments for wrapped function
this_duration_limit: float
Max execution time for this function before issuing a warning.'

def _persist_input(self, output_dir, duration, args, kwargs, this_duration_limit=0.5):

    start_time = time.time()
    argument_dict = filter_args(self.func, self.ignore, args, kwargs)
    input_repr = dict(((k, repr(v)) for (k, v) in argument_dict.items()))
    metadata = {'duration': duration, 'input_args': input_repr}
    try:
        mkdirp(output_dir)
        filename = os.path.join(output_dir, 'metadata.json')
        def write_func(output, dest_filename):
            with open(dest_filename, 'w') as f:
                json.dump(output, f)
        concurrency_safe_write(metadata, filename, write_func)
    except Exception:
        pass
    this_duration = (time.time() - start_time)
    if (this_duration > this_duration_limit):
        warnings.warn(("Persisting    input    arguments    took    %.2fs    to    run.\nIf    this    happens    often    in    your    code,    it    can    cause    performance    problems    \n(results    will    be    correct    in    all    cases).    \nThe    reason    for    this    is    probably    some    large    input    arguments    for    a    wrapped\n    function    (e.g.    large    strings).\nTHIS    IS    A    JOBLIB    ISSUE.    If    you    can,    kindly    provide    the    joblib's    team    with    an\n    example    so    that    they    can    fix    the    problem." % this_duration), stacklevel=5)
    return metadata
