Tries to load the hook to the event

        Args:
            function (func): Function that will be called when the event is called

        Kwargs:
            dependencies (str): String or Iterable with modules whose hooks should be called before this one

        Raises:
            NameError

        Note that the dependencies are module-wide, that means that if
        `parent.foo` and `parent.bar` are both subscribed to `example` event
        and `child` enumerates `parent` as dependcy, **both** `foo` and `bar`
        must be called in order for the dependcy to get resolved.

def hook(self, function, event, dependencies):
        """Tries to load the hook to the event

        Args:
            function (func): Function that will be called when the event is called

        Kwargs:
            dependencies (str): String or Iterable with modules whose hooks should be called before this one

        Raises:
            NameError

        Note that the dependencies are module-wide, that means that if
        `parent.foo` and `parent.bar` are both subscribed to `example` event
        and `child` enumerates `parent` as dependcy, **both** `foo` and `bar`
        must be called in order for the dependcy to get resolved.
        """
        # Hooks all events (recursively)
        if event is None:
            for e in self._events.keys():
                self.hook(function, e, dependencies)
            return

        # Hook multiple, but specific events (recursively)
        if not isinstance(event, str) and isinstance(event, Iterable):
            for e in event:
                self.hook(function, e, dependencies)
            return

        # Hook a simple event
        event_list = self._events.get(event, None)
        if event_list is None:
            raise NameError(
                "Invalid key provided '%s'. Valid options: %s"
                % (event, ", ".join(self._events.keys()))
            )
            return

        return event_list.hook(function, dependencies)