def _codons2re(codons):
 reg = ''
 for i in izip(*codons):
  if (len(set(i)) == 1):
   reg += ''.join(set(i))
  else:
   reg += (('[' + ''.join(set(i))) + ']')
 return reg

def _codons2re ( codons ) : reg = '' for i in izip ( * codons ) : if ( len ( set ( i ) ) == 1 ) : reg += '' . join ( set ( i ) ) else : reg += ( ( '[' + '' . join ( set ( i ) ) ) + ']' ) return reg
generate regular expression based on a given list of codons .