def get_barcode_umis(read, cell_barcode=False):
    """ extract the umi +/- cell barcode from the read name where the barcodes
    were extracted using umis"""
    umi, cell = None, None
    try:
        read_name_elements = read.qname.split(':')
        for element in read_name_elements:
            if element.startswith('UMI_'):
                umi = element[4:].encode('utf-8')
            elif element.startswith('CELL_') and cell_barcode:
                cell = element[5:].encode('utf-8')
        if umi is None:
            raise ValueError()
        return umi, cell
    except:
        raise ValueError(
            'Could not extract UMI +/- cell barcode from the read tag')
