def normalize_housecode(house_code):
if house_code is None:<EOL><INDENT>raise X10InvalidHouseCode('<STR_LIT>' % house_code)<EOL><DEDENT>if not isinstance(house_code, basestring):<EOL><INDENT>raise X10InvalidHouseCode('<STR_LIT>' % house_code)<EOL><DEDENT>if len(house_code) != <NUM_LIT:1>:<EOL><INDENT>raise X10InvalidHouseCode('<STR_LIT>' % house_code)<EOL><DEDENT>house_code = house_code.upper()<EOL>if not ('<STR_LIT:A>' <= house_code <= '<STR_LIT:P>'):<EOL><INDENT>raise X10InvalidHouseCode('<STR_LIT>' % house_code)<EOL><DEDENT>return house_code<EOL>
Returns a normalized house code, i.e. upper case.
    Raises exception X10InvalidHouseCode if house code appears to be invalid