def set_user_loc(self, master_or_instance, value):
if hasattr(master_or_instance, "<STR_LIT>"):<EOL><INDENT>if self.user_loc_key is not None and hasattr(<EOL>master_or_instance, self.user_loc_key<EOL>):<EOL><INDENT>code = user_loc_value_to_instance_string(self.tag, value)<EOL>value_for_code = user_loc_string_to_value(self.tag, code)<EOL>setattr(master_or_instance, self.user_loc_key, code)<EOL>if self.user_loc_param is not None and value != value_for_code:<EOL><INDENT>try:<EOL><INDENT>class_ = user_loc_value_to_class(self.tag, value)<EOL>master_or_instance.customParameters[<EOL>self.user_loc_param<EOL>] = class_<EOL><DEDENT>except NotImplementedError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>return<EOL><DEDENT>if self.user_loc_param is not None:<EOL><INDENT>try:<EOL><INDENT>class_ = user_loc_value_to_class(self.tag, value)<EOL>master_or_instance.customParameters[self.user_loc_param] = class_<EOL><DEDENT>except NotImplementedError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>loc_param = master_or_instance.customParameters["<STR_LIT>"]<EOL>if loc_param is None:<EOL><INDENT>loc_param = []<EOL>master_or_instance.customParameters["<STR_LIT>"] = loc_param<EOL><DEDENT>location = None<EOL>for loc in loc_param:<EOL><INDENT>if loc.get("<STR_LIT>") == self.name:<EOL><INDENT>location = loc<EOL><DEDENT><DEDENT>if location is None:<EOL><INDENT>loc_param.append({"<STR_LIT>": self.name, "<STR_LIT>": value})<EOL><DEDENT>else:<EOL><INDENT>location["<STR_LIT>"] = value<EOL><DEDENT>
Set the user location of a Glyphs master or instance.