Submit a job via qsub.

def qsub(script, job_name, dryrun=False, *args, **kwargs):
    """Submit a job via qsub."""
    print("Preparing job script...")
    job_string = gen_job(script=script, job_name=job_name, *args, **kwargs)
    env = os.environ.copy()
    if dryrun:
        print(
            "This is a dry run! Here is the generated job file, which will "
            "not be submitted:"
        )
        print(job_string)
    else:
        print("Calling qsub with the generated job script.")
        p = subprocess.Popen(
            'qsub -V', stdin=subprocess.PIPE, env=env, shell=True
        )
        p.communicate(input=bytes(job_string.encode('ascii')))