def dispatch_hook(key, hooks, hook_data):
    """Dispatches a hook dictionary on a given piece of data."""

    hooks = hooks or dict()

    if key in hooks:
        try:
            return hooks.get(key).__call__(hook_data) or hook_data

        except Exception, why:
            warnings.warn(str(why))

    return hook_data
def dispatch_hook ( key , hooks , hook_data ) : hooks = hooks or dict ( ) if key in hooks : try : return hooks . get ( key ) . __call__ ( hook_data ) or hook_data except Exception , why : warnings . warn ( str ( why ) ) return hook_data
Dispatches a hook dictionary on a given piece of data.