code: def _check_metrics_file(self, bam_name, metrics_ext):
          
          base, _ = os.path.splitext(bam_name)
          try:
              int(base[-1])
              can_glob = False
          except ValueError:
              can_glob = True
          check_fname = "{base}{maybe_glob}.{ext}".format(
              base=base, maybe_glob="*" if can_glob else "", ext=metrics_ext)
          glob_fnames = glob.glob(check_fname)
          if len(glob_fnames) > 0:
              return glob_fnames[0]
          else:
              return "{base}.{ext}".format(base=base, ext=metrics_ext)
docs: Check for an existing metrics file for the given BAM.