def set_page_size(self, layout):
self.layout = layout.lower()<EOL>if self.layout in self.layout_dict:<EOL><INDENT>self.page_size = self.layout_dict[self.layout]<EOL><DEDENT>else:<EOL><INDENT>dimensions = self.layout.split('<STR_LIT:x>')<EOL>if len(dimensions) == <NUM_LIT:2>:<EOL><INDENT>self.page_size = (float(dimensions[<NUM_LIT:0>]) * <NUM_LIT>, float(dimensions[<NUM_LIT:1>]) * <NUM_LIT>)<EOL><DEDENT>else:<EOL><INDENT>raise IndexError("<STR_LIT>" % len(dimensions))<EOL><DEDENT><DEDENT>
Valid choices: 'a3, 'a4', 'a5', 'letter', 'legal', '11x17'.