def set_weight(self, weight):
if weight is not None:<EOL><INDENT>try:<EOL><INDENT>weight = int(weight)<EOL>if weight < <NUM_LIT:0> or weight > <NUM_LIT:1000>:<EOL><INDENT>raise ValueError()<EOL><DEDENT><DEDENT>except ValueError:<EOL><INDENT>if weight not in weight_dict:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>self._weight = weight<EOL>
Set the font weight.  May be either a numeric value in the
range 0-1000 or one of 'ultralight', 'light', 'normal',
'regular', 'book', 'medium', 'roman', 'semibold', 'demibold',
'demi', 'bold', 'heavy', 'extra bold', 'black'