def get_keras_concurrency_kwargs(args):
    """Get arg dict for setting up concurrency in `keras.model.fit`"""
    result = {}
    result['workers'] = 0

    if args.cache or (args.concurrency is None):
        return result

    if (args.workers is None) or (args.workers < 1):
        return result

    result['workers'] = args.workers

    if args.concurrency == 'process':
        result['use_multiprocessing'] = True
    elif args.concurrency == 'thread':
        result['use_multiprocessing'] = False
    else:
        raise RuntimeError(
            "Unknown parallelization type: %s" % (args.concurrency)
        )

    return result