Helper class for renaming Agent => Trainer with a warning.

def renamed_class(cls):
    """Helper class for renaming Agent => Trainer with a warning."""

    class DeprecationWrapper(cls):
        def __init__(self, config=None, env=None, logger_creator=None):
            old_name = cls.__name__.replace("Trainer", "Agent")
            new_name = cls.__name__
            logger.warn("DeprecationWarning: {} has been renamed to {}. ".
                        format(old_name, new_name) +
                        "This will raise an error in the future.")
            cls.__init__(self, config, env, logger_creator)

    DeprecationWrapper.__name__ = cls.__name__

    return DeprecationWrapper