code: def get_sort_cmd(tmp_dir=None):
      
      has_versionsort = subprocess.check_output("sort --help | grep version-sort; exit 0", shell=True).strip()
      if has_versionsort:
          cmd = "sort -V"
      else:
          cmd = "sort"
      if tmp_dir and os.path.exists(tmp_dir) and os.path.isdir(tmp_dir):
          cmd += " -T %s" % tmp_dir
      return cmd
docs: Retrieve GNU coreutils sort command, using version-sort if available.
  
      Recent versions of sort have alpha-numeric sorting, which provides
      more natural sorting of chromosomes (chr1, chr2) instead of (chr1, chr10).
      This also fixes versions of sort, like 8.22 in CentOS 7.1, that have broken
      sorting without version sorting specified.
  
      https://github.com/bcbio/bcbio-nextgen/issues/624
      https://github.com/bcbio/bcbio-nextgen/issues/1017