<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def attribute_repr_string(inst_str, attr_str):
 """Return a repr string for an attribute that respects line width. Parameters inst_str : str Stringification of a class instance. attr_str : str Name of the attribute (not including the ``'.'``). Returns ------- attr_repr_str : str Concatenation of the two strings in a way that the line width is respected. Examples -------- rn((2, 3)).byaxis MyClass().attr_name MyClass.class_attr MyClass( 'long string that will definitely trigger a line break' ).long_attribute_name """

    linewidth = np.get_printoptions()['linewidth']
    if (len(inst_str) + 1 + len(attr_str) <= linewidth or
            '(' not in inst_str):
        # Instance string + dot + attribute string fit in one line or
        # no parentheses -> keep instance string as-is and append attr string
        parts = [inst_str, attr_str]
    else:
        # TODO(kohr-h): use `maxsplit=1` kwarg, not supported in Py 2
        left, rest = inst_str.split('(', 1)
        right, middle = rest[::-1].split(')', 1)
        middle, right = middle[::-1], right[::-1]

        if middle.startswith('\n') and middle.endswith('\n'):
            # Already on multiple lines
            new_inst_str = inst_str
        else:
            init_parts = [left]
            if middle:
                init_parts.append(indent(middle))
            new_inst_str = '(\n'.join(init_parts) + '\n)' + right
        parts = [new_inst_str, attr_str]

    return '.'.join(parts)