def column_index_from_string(column, fast=False):
 column = column.upper()
 clen = len(column)
 if ((not fast) and (not all((('A' <= char <= 'Z') for char in column)))):
  msg = ('Column string must contain only characters A-Z: got %s' % column)
  raise ColumnStringIndexException(msg)
 if (clen == 1):
  return (ord(column[0]) - 64)
 elif (clen == 2):
  return (((1 + (ord(column[0]) - 65)) * 26) + (ord(column[1]) - 64))
 elif (clen == 3):
  return ((((1 + (ord(column[0]) - 65)) * 676) + ((1 + (ord(column[1]) - 65)) * 26)) + (ord(column[2]) - 64))
 elif (clen > 3):
  raise ColumnStringIndexException('Column string index can not be longer than 3 characters')
 else:
  raise ColumnStringIndexException('Column string index can not be empty')

def column_index_from_string ( column , fast = False ) : column = column . upper ( ) clen = len ( column ) if ( ( not fast ) and ( not all ( ( ( 'A' <= char <= 'Z' ) for char in column ) ) ) ) : msg = ( 'Column string must contain only characters A-Z: got %s' % column ) raise ColumnStringIndexException ( msg ) if ( clen == 1 ) : return ( ord ( column [ 0 ] ) - 64 ) elif ( clen == 2 ) : return ( ( ( 1 + ( ord ( column [ 0 ] ) - 65 ) ) * 26 ) + ( ord ( column [ 1 ] ) - 64 ) ) elif ( clen == 3 ) : return ( ( ( ( 1 + ( ord ( column [ 0 ] ) - 65 ) ) * 676 ) + ( ( 1 + ( ord ( column [ 1 ] ) - 65 ) ) * 26 ) ) + ( ord ( column [ 2 ] ) - 64 ) ) elif ( clen > 3 ) : raise ColumnStringIndexException ( 'Column string index can not be longer than 3 characters' ) else : raise ColumnStringIndexException ( 'Column string index can not be empty' )
convert a column name into a numerical index .