code: def get_barcode_read_id(read, cell_barcode=False, sep="_"):
      ''' extract the umi +/- cell barcode from the read id using the
      specified separator '''
  
      try:
          if cell_barcode:
              umi = read.qname.split(sep)[-1].encode('utf-8')
              cell = read.qname.split(sep)[-2].encode('utf-8')
          else:
              umi = read.qname.split(sep)[-1].encode('utf-8')
              cell = None
  
          return umi, cell
  
      except:
          raise ValueError(
              "Could not extract UMI +/- cell barcode from the read"
              "ID, please check UMI is encoded in the read name"f get_barcode_read_id(read, cell_barcode=False, sep="_"):
      ''' extract the umi +/- cell barcode from the read id using the
      specified separator '''
  
      try:
          if cell_barcode:
              umi = read.qname.split(sep)[-1].encode('utf-8')
              cell = read.qname.split(sep)[-2].encode('utf-8')
          else:
              umi = read.qname.split(sep)[-1].encode('utf-8')
              cell = None
  
          return umi, cell
  
      except:
          raise ValueError(
              "Could not extract UMI +/- cell barcode from the read"
              "ID, please check UMI is encoded in the read name")
docs: extract the umi +/- cell barcode from the read id using the
      specified separator