def attempt_bc_correction(curr_bc, all_bcs, barcode_type='golay_12'):
 corrected_bc = get_exact_bc_matches(curr_bc, all_bcs)
 if corrected_bc:
  return (corrected_bc, 0)
 if (barcode_type == 'golay_12'):
  (corrected_bc, num_errors) = decode_golay_12(curr_bc)
 elif (barcode_type == 'hamming_8'):
  (corrected_bc, num_errors) = decode_barcode_8(curr_bc)
 elif (barcode_type == 0):
  (corrected_bc, num_errors) = ('', 0)
 else:
  (corrected_bc, num_errors) = correct_barcode(curr_bc, all_bcs)
 return (corrected_bc, num_errors)

def attempt_bc_correction ( curr_bc , all_bcs , barcode_type = 'golay_12' ) : corrected_bc = get_exact_bc_matches ( curr_bc , all_bcs ) if corrected_bc : return ( corrected_bc , 0 ) if ( barcode_type == 'golay_12' ) : ( corrected_bc , num_errors ) = decode_golay_12 ( curr_bc ) elif ( barcode_type == 'hamming_8' ) : ( corrected_bc , num_errors ) = decode_barcode_8 ( curr_bc ) elif ( barcode_type == 0 ) : ( corrected_bc , num_errors ) = ( '' , 0 ) else : ( corrected_bc , num_errors ) = correct_barcode ( curr_bc , all_bcs ) return ( corrected_bc , num_errors )
gets corrected barcode and number of errors curr_bc: current barcode sequence to attempt correction with all_bcs: list of all barcode sequences .