"""A set of utility functions."""

import traceback


def get_name():
    """Find the name of the instance of the current class.
    Then store it in the .__name__ attribute."""
    *_, text = traceback.extract_stack()[-3]
    name, *_ = text.split('=')
    return name.strip()

"""A set of utility functions."""

import traceback
import sys


class cached_property:
    """ A property that is only computed once per instance and then replaces
    itself with an ordinary attribute. Deleting the attribute resets the
    property.
    """
    def __init__(self, func):
        self.__doc__ = getattr(func, '__doc__')
        self.func = func

    def __get__(self, obj, cls):
        if obj is None: return self
        value = obj.__dict__[self.func.__name__] = self.func(obj)
        return value


def get_name():
    """Find the name of the instance of the current class.
    Then store it in the .__name__ attribute."""
    *_, text = traceback.extract_stack()[-3]
    if text:
        name, *_ = text.split('=')
        return name.strip()

fix the problem with the .__name__ property in the IDLE shell