def cell_value(sheet, row, col):
cell = sheet.cell(row, col)<EOL>field_type = CELL_TYPES[cell.ctype]<EOL>value = cell.value<EOL>if field_type is None:<EOL><INDENT>return None<EOL><DEDENT>elif field_type is fields.TextField:<EOL><INDENT>if cell.ctype != xlrd.XL_CELL_BLANK:<EOL><INDENT>return value<EOL><DEDENT>else:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT><DEDENT>elif field_type is fields.DatetimeField:<EOL><INDENT>if value == <NUM_LIT:0.0>:<EOL><INDENT>return None<EOL><DEDENT>try:<EOL><INDENT>time_tuple = xlrd.xldate_as_tuple(value, sheet.book.datemode)<EOL><DEDENT>except xlrd.xldate.XLDateTooLarge:<EOL><INDENT>return None<EOL><DEDENT>value = field_type.serialize(datetime.datetime(*time_tuple))<EOL>return value.split("<STR_LIT>")[<NUM_LIT:0>]<EOL><DEDENT>elif field_type is fields.BoolField:<EOL><INDENT>if value == <NUM_LIT:0>:<EOL><INDENT>return False<EOL><DEDENT>elif value == <NUM_LIT:1>:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>elif cell.xf_index is None:<EOL><INDENT>return value  <EOL><DEDENT>else:<EOL><INDENT>book = sheet.book<EOL>xf = book.xf_list[cell.xf_index]<EOL>fmt = book.format_map[xf.format_key]<EOL>if fmt.format_str.endswith("<STR_LIT:%>"):<EOL><INDENT>if value is not None:<EOL><INDENT>try:<EOL><INDENT>decimal_places = len(fmt.format_str[:-<NUM_LIT:1>].split("<STR_LIT:.>")[-<NUM_LIT:1>])<EOL><DEDENT>except IndexError:<EOL><INDENT>decimal_places = <NUM_LIT:2><EOL><DEDENT>return "<STR_LIT>".format(str(round(value * <NUM_LIT:100>, decimal_places)))<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT><DEDENT>elif type(value) == float and int(value) == value:<EOL><INDENT>return int(value)<EOL><DEDENT>else:<EOL><INDENT>return value<EOL><DEDENT><DEDENT>
Return the cell value of the table passed by argument, based in row and column.