def weight_as_number(weight):
if isinstance(weight, str):<EOL><INDENT>try:<EOL><INDENT>weight = weight_dict[weight.lower()]<EOL><DEDENT>except KeyError:<EOL><INDENT>weight = <NUM_LIT><EOL><DEDENT><DEDENT>elif weight in range(<NUM_LIT:100>, <NUM_LIT:1000>, <NUM_LIT:100>):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>return weight<EOL>
Return the weight property as a numeric value.  String values
are converted to their corresponding numeric value.