def get_attr(item, name, default=None):
    """
    similar to getattr and get but will test for class or dict

    :param item:
    :param name:
    :param default:
    :return:
    """
    try:
        val = item[name]
    except (KeyError, TypeError):
        try:
            val = getattr(item, name)
        except AttributeError:
            val = default
    return val