def optimal_mode(data):
 if data.isdigit():
  return MODE_NUMBER
 if RE_ALPHA_NUM.match(data):
  return MODE_ALPHA_NUM
 return MODE_8BIT_BYTE

def optimal_mode ( data ) : if data . isdigit ( ) : return MODE_NUMBER if RE_ALPHA_NUM . match ( data ) : return MODE_ALPHA_NUM return MODE_8BIT_BYTE
calculate the optimal mode for this chunk of data .