def user_loc_value_to_instance_string(axis_tag, user_loc):
codes = {}<EOL>if axis_tag == "<STR_LIT>":<EOL><INDENT>codes = WEIGHT_CODES<EOL><DEDENT>elif axis_tag == "<STR_LIT>":<EOL><INDENT>codes = WIDTH_CODES<EOL><DEDENT>else:<EOL><INDENT>raise NotImplementedError<EOL><DEDENT>class_ = user_loc_value_to_class(axis_tag, user_loc)<EOL>return min(<EOL>sorted((code, class_) for code, class_ in codes.items() if code is not None),<EOL>key=lambda item: abs(item[<NUM_LIT:1>] - class_),<EOL>)[<NUM_LIT:0>]<EOL>
Return the Glyphs UI string (from the instance dropdown) that is
    closest to the provided user location.

    >>> user_loc_value_to_instance_string('wght', 430)
    'Normal'
    >>> user_loc_value_to_instance_string('wdth', 150)
    'Extra Expanded'