def check_barcodes(bc_to_sid, barcode_len, barcode_type):
 barcode_len_in_map = len(bc_to_sid.keys()[0])
 if (barcode_len_in_map != barcode_len):
  raise BarcodeLenMismatchError(('Barcodes in mapping file are of length %d, but expected length is %d.' % (barcode_len_in_map, barcode_len)))
 if (barcode_type == 'golay_12'):
  invalid_golay_barcodes = get_invalid_golay_barcodes(bc_to_sid.keys())
  if invalid_golay_barcodes:
   raise InvalidGolayBarcodeError(('Some or all barcodes in the mapping file are not valid golay codes. Do they need to be reverse complemented? If these are not golay barcodes either pass --barcode_type 12 to disable barcode error correction, or pass --barcode_type  # if the barcodes are not 12 base pairs, where   #  is the size of the barcodes.\n\nInvalid barcodes: %s' % ' '.join(invalid_golay_barcodes)))

def check_barcodes ( bc_to_sid , barcode_len , barcode_type ) : barcode_len_in_map = len ( bc_to_sid . keys ( ) [ 0 ] ) if ( barcode_len_in_map != barcode_len ) : raise BarcodeLenMismatchError ( ( 'Barcodes in mapping file are of length %d, but expected length is %d.' % ( barcode_len_in_map , barcode_len ) ) ) if ( barcode_type == 'golay_12' ) : invalid_golay_barcodes = get_invalid_golay_barcodes ( bc_to_sid . keys ( ) ) if invalid_golay_barcodes : raise InvalidGolayBarcodeError ( ( 'Some or all barcodes in the mapping file are not valid golay codes. Do they need to be reverse complemented? If these are not golay barcodes either pass --barcode_type 12 to disable barcode error correction, or pass --barcode_type  # if the barcodes are not 12 base pairs, where   #  is the size of the barcodes.\n\nInvalid barcodes: %s' % ' ' . join ( invalid_golay_barcodes ) ) )
make sure that barcodes are the correct length that the user specified .