import warnings


def get_property(obj, name, old_name, default=None):
    """
        Check if old property name exists and if it does - show warning message
        and return value.

        Otherwise, return new property value

        :param name:
            New property name
        :param old_name:
            Old property name
        :param default:
            Default value
    """
    if hasattr(obj, old_name):
        warnings.warn('Property %s is obsolete, please use %s instead' %
            (old_name, name), stacklevel=2)
        return getattr(obj, old_name)

    return getattr(obj, name, default)