code: def dispatch_job(jobname, exe, args, opts, batch_opts, dry_run=True):
      
  
      batch_opts.setdefault('W', 300)
      batch_opts.setdefault('R', 'rhel60 && scratch > 10')
  
      cmd_opts = ''
      for k, v in opts.items():
  
          if isinstance(v, list):
              cmd_opts += ' '.join(['--%s=%s' % (k, t) for t in v])
          elif isinstance(v, bool) and v:
              cmd_opts += ' --%s ' % (k)
          elif isinstance(v, bool):
              continue
          elif v is not None:
              cmd_opts += ' --%s=\"%s\" ' % (k, v)
  
      bash_script = "{exe} {args} {opts}"
      scriptexe = jobname + '.sh'
      with open(os.path.join(scriptexe), 'wt') as f:
          f.write(bash_script.format(exe=exe, args=' '.join(args),
                                     opts=cmd_opts))
  
      batch_optstr = parse_lsf_opts(**batch_opts)
      batch_cmd = 'bsub %s ' % (batch_optstr)
      batch_cmd += ' bash %s' % scriptexe
      print(batch_cmd)
      if not dry_run:
          os.system(batch_cmd)
docs: Dispatch an LSF job.
  
      Parameters
      ----------
      exe : str
          Execution string.
  
      args : list
          Positional arguments.
  
      opts : dict
          Dictionary of command-line options.