+ def get_text(self, location=None):
+ substitutions = self.data.copy()
+
+ if 'direction' in self.data:
+ substitutions['rowcol'] = {
+ 'NORTH': 'column',
+ 'SOUTH': 'column',
+ 'EAST': 'row',
+ 'WEST': 'row',
+ }[self.data['direction']]
+
+ if 'chesspiece' in self.data:
+ substitutions['chesspiece_name'] = self.data['chesspiece'].lower()
+
+ if location is None:
+ substitutions['location_bits'] = 'bits specified by this location'
+ else:
+ substitutions['location_bits'] = bit_glyphs(
+ location.bitwise_operand)
+
+ return self.TEXT % substitutions