def generate_dir2save(opt):
    """
    Generate directory to save depending on the mode.

    Arguments:
        opt (argparse.ArgumentParser) : Command line arguments.

    Returns:
        dir2save (String) : Relative path to directory in which files are stored.
    """
    dir2save = None
    if (opt.mode == 'train'):
        dir2save = 'TrainedModels/%s/%s,scale_factor=%f,alpha=%f' % (opt.content[:-4], opt.style[:-4], opt.scale_factor_init, opt.alpha)

    elif opt.mode == 'random_samples':
        dir2save = '%s/RandomSamples/%s/gen_start_scale=%d' % (opt.out,opt.content[:-4], opt.gen_start_scale)

    elif opt.mode == 'random_samples_arbitrary_sizes':
        dir2save = '%s/RandomSamples_ArbitrarySizes/%s/scale_v=%f_scale_h=%f' % (opt.out,opt.content[:-4], opt.scale_v, opt.scale_h)

    return dir2save