def compute_canonical_form(property_name, value):
 if isinstance(value, basestring):
  for (canonical_form, rexps) in properties_rexps[property_name].items():
   for rexp in rexps:
    if rexp.match(value):
     return canonical_form
 return None

def compute_canonical_form ( property_name , value ) : if isinstance ( value , basestring ) : for ( canonical_form , rexps ) in properties_rexps [ property_name ] . items ( ) : for rexp in rexps : if rexp . match ( value ) : return canonical_form return None
return the canonical form of a property given its type if it is a valid one .