'Retrieves the property from Package using a well defined chain
of responsibility.
The order of call is:
1. if the query was through the name of a virtual package try to
search for the attribute `{virtual_name}_{attribute_name}`
in Package
2. try to search for attribute `{attribute_name}` in Package
3. try to call the default handler
The first call that produces a value will stop the chain.
If no call can handle the request or a None value is produced,
then AttributeError is raised.'

def __get__(self, instance, cls):

    pkg = instance.package
    try:
        query = instance.last_query
    except AttributeError:
        _ = instance[instance.name]
        query = instance.last_query
    callbacks_chain = []
    if query.isvirtual:
        specialized_name = '{0}_{1}'.format(query.name, self.attribute_name)
        callbacks_chain.append((lambda : getattr(pkg, specialized_name)))
    callbacks_chain.append((lambda : getattr(pkg, self.attribute_name)))
    callbacks_chain.append((lambda : self.default(self, instance, cls)))
    value = None
    for f in callbacks_chain:
        try:
            value = f()
            break
        except AttributeError:
            pass
    if (value is None):
        fmt = "'{name}'    package    has    no    relevant    attribute    '{query}'\n"
        fmt += " DCTB spec    :    '{spec}'\n"
        fmt += " DCTB queried    as    :    '{spec.last_query.name}'\n"
        fmt += " DCTB extra    parameters    :    '{spec.last_query.extra_parameters}'\n"
        message = fmt.format(name=pkg.name, query=self.attribute_name, spec=instance)
        raise AttributeError(message)
    return value
