code: def parse_sam_read(sam):
      
      
      if isinstance(sam, str):
          sam = sam.strip().split('\t')
          
      if not isinstance(sam, list):
          return None
      
      qname = sam[0]
      flag = int(sam[1])
      rname = sam[2]
      pos = int(sam[3])
      mapq = int(sam[4])
      cigar = sam[5]
      rnext = sam[6]
      pnext = int(sam[7])
      tlen = int(sam[8])
      seq = sam[9]
      qual = sam[10]
      
      tags = sam[11:]
      
      read = SamRead(qname, flag, rname, pos, mapq, cigar, rnext, pnext, tlen, seq, qual, tags)
      
      return read
docs: Parses a SAM alignment and returns a SamFile object.
      
      Parameters
      ----------
      sam : str or list
          Either a tab delimited SAM string, or an already tokenized 
          list of SAM fields.
      
      Returns
      -------
      SamRead
          a SamRead object representation of the SAM alignment.