'Return whether a resource have a hook set in the environment.
For a given resource and a hook type, we check to see if the passed
group of resources has the right hook associated with the name.
Hooks are set in this format via `resources`:
"res_name": {
"hooks": [pre-create, pre-update]
"*_suffix": {
"hooks": pre-create
"prefix_*": {
"hooks": pre-update
A hook value is either `pre-create`, `pre-update` or a list of those
values. Resources support wildcard matching. The asterisk sign matches
everything.'

def matches_hook(self, resource_name, hook):

    ress = self._registry['resources']
    for (name_pattern, resource) in six.iteritems(ress):
        if fnmatch.fnmatchcase(resource_name, name_pattern):
            if ('hooks' in resource):
                hooks = resource['hooks']
                if isinstance(hooks, six.string_types):
                    if (hook == hooks):
                        return True
                elif isinstance(hooks, collections.Sequence):
                    if (hook in hooks):
                        return True
    return False
