def __call__(cls, key, *args, **kw):
    """Call cls as a function. It checks if the `key` instance already exists.

        Args:
            key (string): instance name.
            *args: Variable length argument list.
            **kw: Arbitrary keyword arguments.

        Returns:
            object: new instance is the key does not exist in the instances dictionary, or the instance
            already created with that key.
        """
    instance = cls.__instances.get(key)
    if instance is None:
        instance = type.__call__(cls, key, *args, **kw)
        cls.__instances[key] = instance
    return instance
