'if passed a function, directly sets attributes on the function
which will make it discoverable to add_hookspecs().  If passed no
function, returns a decorator which can be applied to a function
later using the attributes supplied.
If firstresult is True the 1:N hook call (N being the number of registered
hook implementation functions) will stop at I<=N when the I\'th function
returns a non-None result.
If historic is True calls to a hook will be memorized and replayed
on later registered plugins.'

def __call__(self, function=None, firstresult=False, historic=False):

    def setattr_hookspec_opts(func):
        if (historic and firstresult):
            raise ValueError('cannot    have    a    historic    firstresult    hook')
        setattr(func, (self.project_name + '_spec'), dict(firstresult=firstresult, historic=historic))
        return func
    if (function is not None):
        return setattr_hookspec_opts(function)
    else:
        return setattr_hookspec_opts
